Conversation
…credential-shaped name
The env.kv value capture is `[^\s'"]{8,}` — any run of non-space, non-quote
characters — so it matches code as well as literals. With a credential-shaped
name in front (bare `session`, `token`, `password`), ordinary source lines
raise a MEDIUM confirm on every push:
session = _FlakySession(requests.ReadTimeout("Read timed out"))
session = find_session(client, args.session_id, now=now, state=state)
token = make_token(user, scopes=["read"])
password = getpass.getpass()
Each value's mixed case clears the 3.0-bit entropy gate. `validate` sees the
span, never the file, so the calibration is on the span's shape — as a
negative test on exactly one code shape: a call, i.e. an identifier or dotted
path immediately followed by `(`. Nothing else is excluded: a character
allow-list would silence real passwords carrying `!#$&*`
(`Tr0ub4dor&3!xyz`), and excluding dotted paths would silence passphrases
(`correct.horse.battery.staple`).
Tests: the four calls above plus a FastAPI `Depends(...)` stay silent; hex,
base64 with padding, JWT, `sk-…`, a percent-encoded DSN, five
punctuation-heavy passwords, a dotted passphrase and every existing env.kv
case still fire. On a project where `session` is a domain word, the pre-push
hook refused two pushes in a row on lines that only construct or look up a
session.
|
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 |
Author
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.
Problem
The
env.kvvalue capture is[^\s'"]{8,}— any run of non-space, non-quote characters — so it matches code as well as literals. With a credential-shaped name in front (baresession,token,passwordall passisCredentialShapedEnvNameas bare suffixes), an ordinary source line is a MEDIUM finding whenever the expression's mixed case clears the 3.0-bit entropy gate.Two pushes in a row were refused on a project where
sessionis a domain word (a local pre-push stage that treats MEDIUM as blocking on a public repo), on these exact lines:Neither line contains a secret. The first was worked around by renaming the variable; the second is production code where
sessionis the right name.Fix
validatesees only the span, never the file, so the calibration is on the span's shape — as a negative test on exactly one code shape: a call, i.e. an identifier or dotted path immediately followed by(.Nothing else is excluded, deliberately:
!#$&*(Tr0ub4dor&3!xyz);settings.API_KEY) silenced passphrases (correct.horse.battery.staple) and fixed no false positive actually met.Measurements
Four variants scanned side by side (upstream
v1.79.0.0, the allow-list attempt, call + dotted-path, call only):==, JWT,sk-…,%-encoded DSN, five!#$&*passwords, a dotted passphrase)env.kvcases already intest/redact-engine.test.tsTests
env.kv ignores function calls assigned to credential-shaped names: the four calls above plus a FastAPIDepends(...)stay silent.env.kv still fires on literal secrets whatever punctuation they carry: hex, base64 with padding, JWT,sk-…, percent-encoded DSN, five punctuation-heavy passwords,correct.horse.battery.staple(bare and quoted).bun testover the 16 redact/telemetry files: 325 pass, 0 fail. Tier 1 static checks otherwise untouched (no SKILL.md change).🤖 Generated with Claude Code