Repository navigation
fix(secret): detect Mailchimp API keys from every datacenter, not only us20 - #11735
apex-engine-dev wants to merge 3 commits into
Conversation
|
|
||
| // Mailchimp API keys end in "-us<N>", where N is the account's datacenter. The | ||
| // keys are assembled at runtime so no complete key-shaped string is committed. | ||
| func TestSecretScannerMailchimpDatacenters(t *testing.T) { |
There was a problem hiding this comment.
Other rules are tested as cases in TestSecretScanner with a fixture in testdata/. This one could be a case there too, with testdata/mailchimp-api-key.txt. If push protection blocks the fixture, you can bypass it with the "It's used in tests" reason.
There was a problem hiding this comment.
I tried moving it into TestSecretScanner with testdata/mailchimp-api-key.txt, but push protection kept rejecting the fixture even after allowing both keys with the "It's used in tests" reason. So I've kept it as a separate test that assembles the keys at runtime (the other two points are done in 4c97990). If you'd prefer the fixture form, feel free to move it over, or let me know and I'll try again.
There was a problem hiding this comment.
The bypass works for fixtures. Please try once more. Open the unblock URLs from the error, choose "It's used in tests", then run the same git push again without changing the commit.
4c97990 to
3fbe25c
Compare
|
Thanks, that worked. Moved it into |
Description
There's no issue for this; it's a one-line regex fix, so the justification is here as
pr.mdallows.The built-in
mailchimp-api-keyrule only matches keys ending in-us20. Mailchimp API keys end in-us<N>, where N is the account's datacenter (us1, us6, us21, …), so trivy currently misses keys from every datacenter except us20.This changes the suffix to
-us[0-9]{1,2}. The keyword and the rest of the pattern are unchanged.Tests
New
TestSecretScannerMailchimpDatacenters: a us6 key and a us20 key must both be found, while a bare 32-hex list ID and a"us6"server value must stay clean. The keys are assembled at runtime rather than stored in a testdata file, because GitHub push protection rejects key-shaped fixtures.[2]only (the us6 key is missed).go test ./pkg/fanal/secret/...passes;gofmtandgo vetare clean.Checklist