How praetorian-inc/titus works
Purpose and entry points
Titus is a Go-based secrets scanner for source trees, Git history, repositories, container images, and extracted binary content. It is exposed as:
• CLI commands rooted at cmd/titus/main.go and cmd/titus/root.go, including scan, report, serve, rules, explore, and enumeration commands.
• An embeddable Go API in titus.go.
• A WASM scanner used by the Chrome extension: wasm/main.go, wasm/scanner.go.
• A Burp Suite Java extension: burp/src/main/java/com/praetorian/titus/burp/TitusExtension.java.
Scan orchestration and input acquisition
The CLI scan path coordinates inputs, rule selection, persistence, validation, scoring, and output in cmd/titus/scan.go. Enumeration adapters acquire scan material from local filesystems, Git repositories/history, GitHub/GitLab, OCI/Docker images, and SaaS sources; their shared boundary is pkg/enum/enum.go, with representative implementations in pkg/enum/git.go, pkg/enum/docker.go, and pkg/enum/github.go.
Acquired content is modeled with locations, provenance, snippets, matches, findings, and scores under pkg/types/finding.go, pkg/types/provenance.go, and pkg/types/match.go. This keeps source-specific acquisition separate from detection and reporting.
Rule loading and detection engine
Detection rules are embedded YAML assets, loaded and validated by pkg/rule/loader.go and pkg/rule/validate.go, with the default ruleset at pkg/rule/rulesets/default.yml and individual definitions under pkg/rule/rules/. Rules provide patterns, captures, metadata, filtering, noise behavior, and base risk inputs.
pkg/scanner/core.go drives scanning over content. pkg/matcher/matcher.go and pkg/matcher/extended.go implement matching, capture extraction, context, deduplication, and post-filtering. The matching backend is a material runtime boundary: pkg/matcher/matcher_vectorscan.go uses CGO-backed Vectorscan/Hyperscan when built with the relevant tag, while pkg/matcher/matcher_default.go provides the portable Go fallback.
Finding lifecycle: validation and scoring
Raw detections can be validated against provider APIs by the concurrent validation engine in pkg/validator/engine.go; provider-specific validators and declarative validator definitions live in pkg/validator/ and pkg/validator/validators/. This is an outbound-network boundary and can contact credential-provider APIs.
Risk scoring is a separate stage in pkg/scoring/engine.go, using YAML and Go scorers from pkg/scoring/scorers/ and provider clients such as pkg/scoring/aws_client.go. It combines rule metadata, accessibility context, and optionally live permission/blast-radius checks into typed scores.
Storage, reporting, and service protocol
Findings are persisted behind a store abstraction in pkg/store/store.go, with SQLite and memory implementations in pkg/store/sqlite.go and pkg/store/memory.go. CLI reporting rereads this datastore via cmd/titus/report.go; SARIF conversion is isolated in pkg/sarif/sarif.go.
cmd/titus/serve.go hosts the scanner behind an NDJSON stdin/stdout protocol implemented in pkg/serve/server.go. This process boundary permits non-Go clients to load rules once and submit scan requests without embedding Go.
Extension clients and infrastructure
The Burp extension launches and manages the CLI service process through ProcessManager.java and scans HTTP traffic through TitusProcessScanner.java; queueing, deduplication, persistence, and Burp issue reporting are handled by ScanQueue.java, DedupCache.java, and IssueReporter.java.
The Chrome extension packages the Go WASM artifact (extension/lib/titus.wasm) with service-worker, content, popup, dashboard, and IndexedDB layers at extension/background/service-worker.js, extension/content/content.js, and extension/storage/db.js. It scans browser-accessible page resources and stores findings locally.
Build infrastructure includes Go modules (go.mod), Gradle for the Burp JAR (burp/build.gradle.kts), and GitHub Actions CI/release workflows under .github/workflows/.
Main entry points: scan.go Scan orchestration · core.go Scanner core · enum.go Enumeration adapters · finding.go Finding model
Components 21
Entry points
- CLI commands · Scan, report, serve, rules, explore, and enumeration commands.
cmd/titus/main.go - Scan orchestration · Coordinates input, rules, persistence, validation, scoring, and output.
cmd/titus/scan.go - Embeddable API
titus.go
Acquisition
- Enumeration adapters · Acquires files, Git history, repositories, images, and SaaS content.
pkg/enum/enum.go - Git acquisition
pkg/enum/git.go - Container image acquisition
pkg/enum/docker.go - GitHub acquisition
pkg/enum/github.go - Finding model · Locations, provenance, snippets, matches, findings, and scores.
pkg/types/finding.go
Detection lifecycle
- Rule loader & validation · Loads embedded YAML rules and validates rule definitions.
pkg/rule/loader.go - Scanner core · Drives rule scanning over acquired content.
pkg/scanner/core.go - Matcher pipeline · Matches patterns, extracts captures, applies context, deduplication, and filters.
pkg/matcher/matcher.go - Vectorscan backend · Tagged Vectorscan/Hyperscan matcher runtime.
pkg/matcher/matcher_vectorscan.go - Portable matcher backend
pkg/matcher/matcher_default.go - Validation engine · Concurrently checks raw detections against provider APIs.
pkg/validator/engine.go - Scoring engine · Combines rule metadata, context, and optional live permission checks.
pkg/scoring/engine.go
Storage & delivery
- Finding store · SQLite and memory-backed finding persistence.
pkg/store/store.go - CLI reporting & SARIF · Rereads stored findings and converts them to SARIF.
cmd/titus/report.go - NDJSON scanner service · Long-lived stdin/stdout service for non-Go clients.
pkg/serve/server.go
Extension clients
- WASM scanner · Go scanner compiled for the Chrome extension.
wasm/scanner.go - Chrome extension · Scans page resources and persists findings in IndexedDB.
extension/background/service-worker.js - Burp Suite extension · Launches the CLI service and scans HTTP traffic.
burp/src/main/java/com/praetorian/titus/burp/TitusExtension.java
Connections 27
- CLI commands → Scan orchestration: runs
- Scan orchestration → Enumeration adapters: acquires input
- Embeddable API → Scanner core: invokes
- Git acquisition → Enumeration adapters: implements
- Container image acquisition → Enumeration adapters: implements
- GitHub acquisition → Enumeration adapters: implements
- Enumeration adapters → Finding model: produces content context
- Scan orchestration → Rule loader & validation: loads rules
- Scan orchestration → Scanner core: orchestrates
- Finding model → Scanner core: scan material
- Rule loader & validation → Scanner core: scan rules
- Scanner core → Matcher pipeline: detects with
- Matcher pipeline → Vectorscan backend: CGO build
- Matcher pipeline → Portable matcher backend: default build
- Matcher pipeline → Finding model: raw findings
- Scan orchestration → Validation engine: optionally validates
- Validation engine → Finding model: validation state
- Scan orchestration → Scoring engine: scores
- Scoring engine → Finding model: typed scores
- Scan orchestration → Finding store: persists
- CLI reporting & SARIF → Finding store: reads findings
- CLI commands → CLI reporting & SARIF: runs
- CLI commands → NDJSON scanner service: hosts
- NDJSON scanner service → Scanner core: submits requests
- WASM scanner → Scanner core: browser build variant
- Chrome extension → WASM scanner: packages
- Burp Suite extension → NDJSON scanner service: manages CLI process