Populate SecretParts on all detectors#4919
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, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 57093b7. Configure here.
| SecretParts: map[string]string{ | ||
| "url": portalLink, | ||
| "email": email, | ||
| }, |
There was a problem hiding this comment.
ClickHelp SecretParts omits the API key component
Medium Severity
The SecretParts map for the ClickHelp detector includes "url" and "email" but omits apiKey, which is the actual secret credential. The detector iterates over three nested loops (portalLink, email, apiKey), and the apiKey is used for authentication via SetBasicAuth(email, apiKey) and is even explicitly flagged via s1.SetPrimarySecretValue(apiKey). Omitting it from SecretParts means the most sensitive component of the credential is not tracked.
Reviewed by Cursor Bugbot for commit 57093b7. Configure here.
There was a problem hiding this comment.
This is a good callout and makes me question why apiKey isn't part of the Raw??
There was a problem hiding this comment.
The SecretParts match what is used in RawV2, so for consistency I want to keep this as is, even if it's wrong.
It will be a good guinea pig for supporting hash migrations in enterprise once that work is complete.
Adds SecretParts: map[string]string{"key": <secret>} to every detector
package that constructs detectors.Result with a single captured secret
value. This is the single-part half of the SecretParts migration (the
linter's common case, ~695 packages).
57093b7 to
5d5a825
Compare
* Populate SecretParts on single-part detectors
Adds SecretParts: map[string]string{"key": <secret>} to every detector
package that constructs detectors.Result with a single captured secret
value. This is the single-part half of the SecretParts migration (the
linter's common case, ~695 packages).
* Populate SecretParts on multi-part detectors


Summary
Populates
Result.SecretPartson every detector package that constructsdetectors.Result{}without it. This is the last migration step in theSecretParts effort — after this, the
checksecretpartsstatic checkreports zero findings across all 898 detector packages and can be flipped
from warning-only to hard-fail in a one-line follow-up.
Stacks on #4913 (which introduces the
checksecretpartslinter and iswhat surfaces the list of unmigrated detectors this PR works through).
Depends transitively on #4911 (rename) and #4912 (docs).
Approach
Two commits:
Single-part detectors (~695 packages) — the common case where a
detector captures a single secret value. Adds
SecretParts: map[string]string{"key": <value>}alongside theexisting
Raw: []byte(<value>).Multi-part detectors (~125 packages) — detectors that capture
multiple components (key/secret, client_id/client_secret, host/user/
password, etc.). Each gets a multi-entry
SecretPartsmap keyed bythe component's role.
Test plan
go build ./...go vet ./pkg/detectors/...go run ./hack/checksecretparts -fail— 898 packages scanned, 0 findingsgo test ./pkg/detectors/...— 895 packages ok, 0 FAILNote
Medium Risk
Broad mechanical change across hundreds of detector implementations; while mostly additive metadata, mistakes in per-detector
SecretPartskeys/values could affect downstream analyzers or deduping/verification that expects specific component naming.Overview
Populates
detectors.Result.SecretPartsfor detectors that previously only setRaw/RawV2, including single-value detectors (adding{ "key": <value> }) and multi-part detectors (adding role-keyed maps likekey/secret,id/token,url/password, etc.).This standardizes structured secret component output across the detector suite (including some results that also use
RawV2,Redacted, andExtraData) without changing the underlying match/verification flows.Reviewed by Cursor Bugbot for commit 5d5a825. Bugbot is set up for automated code reviews on this repo. Configure here.