Add environment variable credential detection (#19)
authorMax Wolf <redacted>
Mon, 12 Jan 2026 15:02:29 +0000 (16:02 +0100)
committerGitHub <redacted>
Mon, 12 Jan 2026 15:02:29 +0000 (16:02 +0100)
commita1d0db797a7feb1c70e2b181f0a26762ab196fc5
tree3104430441e770b6fdecb46db5fa318e95f961a1
parent1c206687bc3ed193008b1493c87a7690a7901e35
Add environment variable credential detection (#19)

* Add PatternDetector and DetectionResult interfaces for secrets detection registry

* Move pattern detection utility to new patterns/utils.ts module

* Refactor secrets detection using a registry system

- Create privateKeysDetector, apiKeysDetector, tokensDetector modules
- Refactor detectSecrets() to use the pattern registry
- Re-export types from detect.ts for backwards compatibility

* Change default secrets_detection action to redaction

Hint: The example config still shows `action: block` explicitly, with a comment noting
that `redact` is the default action if not specified

* Implement new pattern detector and add corresponding SecretEntityType options

* Register new detector and extend test suite accordingly

* Add new entity types to config.ts

* Update docs and example config

* Add environment variables section to secrets detection docs

---------

Co-authored-by: Stefan Gasser <redacted>
12 files changed:
README.md
config.example.yaml
docs/concepts/secrets-detection.mdx
docs/configuration/secrets-detection.mdx
docs/introduction.mdx
src/config.ts
src/secrets/detect.test.ts
src/secrets/detect.ts
src/secrets/patterns/env-vars.ts [new file with mode: 0644]
src/secrets/patterns/index.ts
src/secrets/patterns/types.ts
src/secrets/patterns/utils.ts
git clone https://git.99rst.org/PROJECT