feat: add FrameworkSecretKey detector for Symfony, Laravel, Django, Rails #4696
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new detector for framework secret keys commonly exposed in
.envfiles and configuration. This addresses #4687.Supported Frameworks
APP_SECRET[a-f0-9]{32,64}APP_SECRET=a1b2c3d4...APP_KEYbase64:[A-Za-z0-9+/]{42,44}={0,2}APP_KEY=base64:wJalr...SECRET_KEYSECRET_KEY='django-insecure-...'SECRET_KEY_BASE[a-f0-9]{64,128}SECRET_KEY_BASE=abc123...Security Impact
These secrets enable attackers to:
Implementation Details
SECRET_KEY_BASEfrom also matching asSECRET_KEYa1b2c3d4...****789aExtraDataincludes framework name, variable, and documentation URLChanges
proto/detectors.proto- AddFrameworkSecretKey = 1040pkg/detectors/frameworksecret/- New detector with testspkg/engine/defaults/defaults.go- Register detectorTest Plan
go test ./pkg/detectors/frameworksecret/... -v).envfilesTest Output
References
Closes #4687