feat(redact): add Groq, Tavily and Notion API key patterns - #2730
Open
schienbiz wants to merge 1 commit into
Open
feat(redact): add Groq, Tavily and Notion API key patterns#2730schienbiz wants to merge 1 commit into
schienbiz wants to merge 1 commit into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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.
The gap
Three provider key shapes have no pattern, so a bare key — one not written as
NAME=value— is not detected at all.Measured against
b5a951ewithbin/gstack-redact --from-file, one shape per file:gsk_…on its owntvly-dev-…on its ownntn_…on its ownGROQ_API_KEY=gsk_…env.kvNOTION_TOKEN=ntn_…env.kvenv.kvcovers the assignment form, which is the common case in a.env— but it keys on the variable name, so a key in a comment, a URL, a JSON blob or a test fixture is invisible. That is the shape a key most often escapes in, and it is why the prefixed provider patterns (openai.key,anthropic.key,huggingface.token,npm.token, …) exist alongsideenv.kvrather than instead of it.The change
Three patterns, in the shape of the existing provider entries:
HIGH follows the taxonomy's own calibration rather than my preference: every provider-prefixed secret credential in the file is HIGH (
openai.key,anthropic.key,github.pat,sendgrid.key,slack.token,huggingface.token,npm.token,digitalocean.token,twilio.auth_token), and the two MEDIUM exceptions are there for stated reasons that do not apply here —stripe.publishableis public by design,google.api_keyis context-variable. These three are single-purpose secret tokens with distinctive prefixes; agsk_-prefixed 40-character token is not context-variable.Notes on the specific regexes:
(?:dev-|prod-)?) rather than using a globally-optional segment, for the same reasonopenai.keydoes — an optional segment would also match separator-lesstvly-devabc….ntn_(current) andsecret_(legacy, still in circulation). The legacy prefix is an ordinary English word, so the{40,}floor is what makes it a credential rather than prose —secret_valuedoes not match, and there is a negative test for exactly that.test/redact-pattern-lint.test.tspasses.Tests
Positive cases added to the
redact-enginetable, negatives to the#1946 pattern negativesblock (gsk_key,tvly-key,ntn_token,secret_valuemust not fire).The generated docs pick the descriptions up from the taxonomy, so nothing was hand-edited.
Context
Found while auditing a sixteen-repo fleet where every one of these three is a live key. Not related to #2358 (chained
pre-push.localstdin) — that is a separate wrapper bug with its own PR, and this change is independent of it.I have no way to verify Groq/Tavily/Notion key lengths beyond published formats and live keys I hold, so the floors are deliberately conservative: they are false-positive guards, and the prefix carries the signal. Happy to tighten them to exact lengths if you would rather pin them.