[INS-345] Add New Relic Insights Query Key detector#4781
[INS-345] Add New Relic Insights Query Key detector#4781mustansir14 wants to merge 2 commits intotrufflesecurity:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| uniqueAccountIDMatches[match[1]] = struct{}{} | ||
| } | ||
|
|
||
| for _, keyMatch := range keyMatches { |
There was a problem hiding this comment.
Key matches not deduplicated unlike other multi-part detectors
Medium Severity
Account ID matches are deduplicated into uniqueAccountIDMatches, but keyMatches is iterated directly from FindAllStringSubmatch without deduplication. Other multi-part detectors in the codebase (e.g., adobeio, airbrakeprojectkey, airship) consistently deduplicate both parts into maps before the nested loops. This inconsistency means duplicate keys in scanned data produce duplicate results and redundant verification API calls.
There was a problem hiding this comment.
This is intended. The idea is to report multiple results if the key appears in multiple places, so that the user can remove it from all of those places.
Account ID matches are deduplicated because they are not the primary credential.


Description:
This PR adds the New Relic Insights Query Key Detector.
Regex:
Key:
\b(NRIQ-[a-zA-Z0-9-_]{25})Account ID:
detectors.PrefixRegex([]string{"relic", "account", "id"}) + '\b(\d{4,10})\b'The key is the actual credential but account ID is required for verification because the verification endpoint requires an account ID in the path, and there is no other deterministic way to verify the credential without specifying the valid account ID (invalid or malformed account IDs return the same response as an invalid key)
Verification:
For verification, we use the Insights Query API with a simple select query:
https://insights-api.newrelic.com/v1/accounts/[account_id]/query?nrql=SELECT%%201.We send a GET request. A response code of
200means the key is valid.401means it is an invalid/rotated key.Note: For EU region keys, the host should be
insights-api.eu.newrelic.comCorpora Test:


The detector does not appear in the list.
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Cursor Bugbot is generating a summary for commit 713d4e0. Configure here.