Repository navigation
fix(redact): env.kv skips JSX keys joined with ?? / || / && - #3605
Closed
adam-balazs wants to merge 1 commit into
Closed
adam-balazs wants to merge 1 commit into
adam-balazs wants to merge 1 commit into
Conversation
isSourceExpression (garrytan#3048) exempts a JSX brace of names in a TS/JSX file, but split its terms on `+` only. A React key such as `key={workout.id ?? index}` was scored as a secret-named assignment and failed the pregate secrets check, which cannot be downgraded. Split on `??`, `||` and `&&` as well. A quoted literal anywhere in the brace still returns false first, and every term must still be an identifier chain, so `key={settings.apiKey ?? "<entropic>"}`, `key={<entropic> || index}` and the same key in a .env file stay findings. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DPbzLA2Ad25KxmYZDoUPpF
|
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 |
Contributor
|
Thank you for this fix. A crew lane is picking it up, together with the related redact PRs, to land on current main with Co-authored-by credit to you. |
Contributor
|
Thanks @adam-balazs. This landed in #3742 (merged as 64fb6ec, v1.92.8.0). That PR rewrote the fix on current main and combined it with the Dart and Python work from #3418 and #3419. Your JSX |
This was referenced Nov 1, 2026
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.
Summary
env.kvflags a React key such askey={workout.id ?? index}in a.jsx/.tsxfile as a secret-named assignment. The pregatesecretscheck can't be downgraded, so a plain JSX key blocks/ship.isSourceExpression(#3048) already exempts a JSX brace of names in TS/JSX source, but it split the brace's terms on+only.{turn.requestId + turn.role + index}passed, while{workout.id ?? index}was scored by entropy and failed.This change splits on
??,||and&&as well as+. Nothing else changes:CODE_NAME_CHAIN, so a non-identifier token (an entropic value starting with a digit) is still a finding;sourcePathis TS/JSX.Tests
test/redact-engine.test.ts, in the existing #3048 test:key={workout.id ?? index}(.jsx),key={item.uuid || item.slug},key={row.ready && row.id}(.tsx).key={settings.apiKey ?? "<entropic>"}(quoted literal)key={<entropic> || index}(not an identifier)key={workout.id ?? index}in a.envfile (no TS/JSX context)Before the fix, the new exempt cases fail. After it,
bun test test/redact*.test.tsgives 475 pass and 0 fail,bun test test/gstack-redact-cli.test.tsgives 17 pass, andbun run typecheckis clean.Checked on the real line: the released 1.91.313.0
gstack-redact --from-file ClientSummary.jsx --jsonreportsenv.kv; this branch reports no findings.The CHANGELOG entry and version stamp are left to a maintainer, per CONTRIBUTING's outside-PR notes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DPbzLA2Ad25KxmYZDoUPpF