feat: add FrameworkSecretKey detector for Symfony, Laravel, Django, Rails#4696
Open
PascalThuet wants to merge 3 commits intotrufflesecurity:mainfrom
Open
feat: add FrameworkSecretKey detector for Symfony, Laravel, Django, Rails#4696PascalThuet wants to merge 3 commits intotrufflesecurity:mainfrom
PascalThuet wants to merge 3 commits intotrufflesecurity:mainfrom
Conversation
Add new detector type for framework secret keys (Symfony, Laravel, Django, Rails) to the protobuf definitions. Relates to trufflesecurity#4687
Add detector for framework secret keys commonly exposed in .env files and configuration: - Symfony APP_SECRET (32+ hex chars) - Laravel APP_KEY (base64:... format) - Django SECRET_KEY (50+ chars, quoted) - Rails SECRET_KEY_BASE (64-128 hex chars) Features: - Shannon entropy filtering for Django secrets - Deduplication to prevent SECRET_KEY_BASE matching as SECRET_KEY - Proper redaction for display - Framework-specific metadata in ExtraData These secrets cannot be verified via API but have high-confidence patterns. Exposed keys allow session forgery, CSRF bypass, and potentially RCE (Laravel). Closes trufflesecurity#4687
Add frameworksecret.Scanner{} to the default detector list.
Relates to trufflesecurity#4687
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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