3.0 KiB
3.0 KiB
Secret Detection and Credential Leak Guard
Module
Scanner
Status
IMPLEMENTED
Description
Secret detection analyzer with leak evidence capture, alert emission, and integration into the scanner worker pipeline. Compatible with Grype credential leak test scenarios.
Implementation Details
- Secrets Analyzer:
src/Scanner/__Libraries/StellaOps.Scanner.Analyzers.Secrets/SecretsAnalyzer.cs-SecretsAnalyzerdetecting exposed secrets (API keys, tokens, passwords, private keys) in container image layers using regex-based detection rulessrc/Scanner/__Libraries/StellaOps.Scanner.Analyzers.Secrets/SecretsAnalyzerHost.cs-SecretsAnalyzerHostmanaging the lifecycle and execution of the secrets analyzersrc/Scanner/__Libraries/StellaOps.Scanner.Analyzers.Secrets/SecretsAnalyzerOptions.cs- Configuration options for detection rules, severity thresholds, and enabled categoriessrc/Scanner/__Libraries/StellaOps.Scanner.Analyzers.Secrets/ServiceCollectionExtensions.cs- DI registration for secrets analysis
- Pipeline Integration:
src/Scanner/StellaOps.Scanner.Worker/Processing/Secrets/SecretsAnalyzerStageExecutor.cs-SecretsAnalyzerStageExecutorscanner worker pipeline stage executing secrets analysis
- Alert Emission:
src/Scanner/__Libraries/StellaOps.Scanner.Core/Secrets/Alerts/SecretAlertEmitter.cs-SecretAlertEmitteremitting alerts for discovered credential leakssrc/Scanner/__Libraries/StellaOps.Scanner.Core/Secrets/Alerts/ISecretAlertEmitter.cs- Interface for alert emission
- Exception Matching:
src/Scanner/__Libraries/StellaOps.Scanner.Core/Secrets/Configuration/SecretExceptionMatcher.cs-SecretExceptionMatchermatching findings against allowlist patterns to suppress known-safe secrets
- Tests:
src/Scanner/__Tests/StellaOps.Scanner.Analyzers.Secrets.Tests/SecretsAnalyzerTests.cs- Unit tests for secret detectionsrc/Scanner/__Tests/StellaOps.Scanner.Analyzers.Secrets.Tests/SecretsAnalyzerIntegrationTests.cs- Integration testssrc/Scanner/__Tests/StellaOps.Scanner.Analyzers.Secrets.Tests/SecretsAnalyzerHostTests.cs- Host lifecycle testssrc/Scanner/__Tests/StellaOps.Scanner.Analyzers.Secrets.Tests/RegexDetectorTests.cs- Regex detection rule tests
E2E Test Plan
- Scan a container image containing known test secrets and verify
SecretsAnalyzerdetects API keys, tokens, and passwords with correct file paths and line numbers - Verify
SecretAlertEmitteremits alerts for each detected secret with severity classification - Verify
SecretExceptionMatchersuppresses findings matching allowlist patterns (e.g., placeholder values, test credentials) - Verify the
SecretsAnalyzerStageExecutorintegrates into the scanner worker pipeline and produces findings in the unified finding format - Verify the analyzer handles large files and binary content without performance degradation or false positives
- Verify compatibility with Grype credential leak test scenarios by running against the same test fixtures