[INS-407] Fixed AWS detector producing non deterministic output#4836
Open
MuneebUllahKhan222 wants to merge 3 commits intotrufflesecurity:mainfrom
Open
[INS-407] Fixed AWS detector producing non deterministic output#4836MuneebUllahKhan222 wants to merge 3 commits intotrufflesecurity:mainfrom
MuneebUllahKhan222 wants to merge 3 commits intotrufflesecurity:mainfrom
Conversation
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.

Description:
When multiple AWS credentials are detected in a single file and verification is disabled, the output of the AWS detector becomes non-deterministic due to unordered processing.
Can be reproduced by creating a file with multiple AWS credentials and running this command
trufflehog --no-update --no-verification filesystem example-creds-file --json | jq -r .RawV2To address this, this PR introduces logic to generate and return all possible combinations of Access Key IDs and Secret Access Keys. This ensures that no potentially valid credential pair is missed during reporting.
When verification is enabled, the existing behaviour remains unchanged.
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Medium Risk
Changes result-cleaning behavior and the
CustomResultsCleanerinterface to depend on the engine’s verification setting, which affects how many findings are emitted (especially when verification is disabled). Risk is moderate because it touches core engine filtering and could change output volume for detectors that implement custom cleaning.Overview
When verification is disabled, AWS access key and session key detectors now keep all detected credential permutations instead of cleaning/de-duping them, eliminating non-deterministic output caused by map iteration order.
To support this, the
CustomResultsCleanerAPI and related engine plumbing were updated soCleanResultsreceivesverificationEnabled(wired fromEngine.verify), and AWS’saws.CleanResultsnow becomes a no-op when verification is off. Tests were expanded to cover multiple-credential inputs and the new cleaner/engine behavior.Written by Cursor Bugbot for commit 329dc5a. This will update automatically on new commits. Configure here.