Skip to content

feat: secret detection and SBOM - #46

Merged
SizzleUnrlsd merged 2 commits into
mainfrom
feat/secrets-sbom
Sep 4, 2026
Merged

SizzleUnrlsd merged 2 commits into
mainfrom
feat/secrets-sbom

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Summary

Two of the three points left open on #37: secret detection and SBOM generation. Both are offline.

  • Acceptance tests first (test: define secret detection and SBOM behavior), implementation follows.
  • plugins/secrets.py: literals walks every string literal of the PyHIR with the name it is bound to (assignment target, keyword argument, dictionary key) and the enclosing function; SecretDetector is a plugin base reporting at most one finding per literal, provider pattern first (hardcoded-secret, high confidence), then a credential-like name bound to a real value (hardcoded-credential, medium; placeholders, references and *_name-style bindings excluded), then an opaque high-entropy token on its own (high-entropy-string, low). Messages and metadata carry a redacted preview and never the secret.
  • plugins/secrets/hardcoded_secrets: the shipped detector with AWS, GitHub, Slack, Stripe, Google, private key, JWT, SendGrid and Twilio formats and the usual credential names. Other plugins add providers by subclassing with their own patterns.
  • dependency/sbom.py: a deterministic CycloneDX 1.5 document from the dependency graph, one component per requirement with its package URL and specifier, optional requirements marked, and the advisories affecting the requirements as vulnerabilities. It lives in the dependency layer because reporters may only see findings. ProjectAnalysis exposes the advisories it used; --sbom PATH writes the document during a directory check.
  • The HIR adapter now accepts annotated assignments (SECRET: str = "..."), which typed settings modules use; a bare declaration is a no-op.

Still open on #37: live OSV and GHSA feeds and dependency policies, which need a decision on network access and advisory caching.

Refs #37

@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 4, 2026
@SizzleUnrlsd
SizzleUnrlsd merged commit 1f0abb4 into main Sep 4, 2026
6 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the feat/secrets-sbom branch September 4, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant