fix(detectors): validate Kraken base64 matches#5018
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76b4951e74
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Thanks for the review. I pushed a follow-up that addresses both points:
Verification:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit db3073b. Configure here.
|
Thanks, this was a valid catch. I pushed a follow-up that puts a second I also mutation-checked the coverage locally:
Verification after restoring the implementation:
|

Summary
Problem
Kraken credentials are base64-encoded values. The existing detector test fixtures included
=padding in the middle of the candidate strings, which is not valid base64. The detector also included the trailing boundary character in the regex capture group, so common quoted forms likeKRAKEN_API_KEY=...could include the closing quote in the captured secret.Fix
The Kraken detector now captures only the credential value and treats the following space/quote/newline as a boundary outside the capture group. It also base64-decodes both the API key and private key candidates before emitting a result, reducing false positives from malformed padding.
Tests
go test ./pkg/detectors/kraken -run '^TestKraken_Pattern$' -tags=detectors -count=1✅Notes
go test ./pkg/detectors/kraken -tags=detectorsis not runnable in this local environment becauseTestKraken_FromChunkrequires GCP Secret Manager application default credentials for test secrets.Note
Low Risk
Scoped Kraken secret-detection changes that reduce false positives; no auth or broad infrastructure impact.
Overview
The Kraken detector now captures only the credential token in regex (trailing space/quote/newline are boundaries, not part of the match) and drops candidates that do not decode as base64 for both API and private keys, including unpadded private keys via
RawStdEncoding. Verification reuses the validated decode for signing instead of ignoring decode errors.Pattern tests use real base64 fixtures, add quoted env-var and unpadded-private-key cases, and expect no hits when padding is malformed.
Reviewed by Cursor Bugbot for commit 360ba92. Bugbot is set up for automated code reviews on this repo. Configure here.