Repository navigation
Conversation
The secret-content pattern was written as `sk-(?:live|test|prod|dev)_`, which needs a hyphen after `sk` and so matched no Stripe key at all: real keys read `sk_live_`/`sk_test_`, and restricted keys read `rk_live_` and `rk_test_`. Publishable keys (`pk_`) stay undetected, as they are not secrets. The existing test only passed because it used the same malformed prefix.
Secret file names were compared as written, so a repository could ship `ID_RSA`, `CERT.PEM` or `Credentials.JSON` and the scan reported no secret risk: the glob ran on the exact-case name. Both sides are now lower-cased, which is also how the file systems these scans run on treat them.
|
@Bhishamt is attempting to deploy a commit to the Sandesh's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
This PR was closed by the contribution policy:
Please resolve the items above, then reopen the PR. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
What changed?
Two false negatives in
packages/scanner/src/classifyFile.ts, both reported as security issues:SECRET_CONTENT_PATTERNShad/sk-(?:live|test|prod|dev)_[A-Za-z0-9]{20,}/, with ahyphen. Stripe spells its keys with an underscore (
sk_live_,sk_test_, and the restrictedrk_live_/rk_test_), so a file holdingSTRIPE_KEY=sk_live_...was classified as ordinarysource and could reach a repo map or a report. The pattern is now
/(?:sk|rk)[_-](?:live|test|prod|dev)_[A-Za-z0-9]{20,}/:skandrkwith live or test oneither separator, and the dashed
sk-live_form the old pattern matched still matches.Publishable keys (
pk_) are not flagged.matchesGlob()compared basenames case-sensitively. On the default Windows and macOSfilesystems
.ENV,ID_RSA,Credentials.jsonandserver.PEMname the same sensitive files,but only the lower-case spelling was flagged. Secret filename globs now match case-insensitively.
The literal prefix check that decides whether a name looks sensitive is unchanged, so a file
still has to be shaped like a secret before the glob is consulted.
Both are detection-only: nothing that was previously flagged stops being flagged, and the
classification result type is unchanged.
Fixes #251
Fixes #254
Contribution prerequisite
Developmentbranch, as the template asks. It targetsmaininstead, see below.Developmentis currently 14 commits behindmain, andpackages/scannerdiffers substantiallybetween them, including the file this PR edits, so a branch based on
Developmentwould carrywork missing from main and edit a stale copy of the scanner. The change is based on
main, wherethe reported code is. Retarget with one click if you would rather land it on
Developmentandmerge forward.
Affected areas
packages/scannerValidation
The two
pnpm testfailures are inapps/cli/tests/catalogCommand.test.ts(catalog validation:valid: trueandmodelCount >= 20). They are not this change: running that file withpackages/scannerreverted tomainreproduces both, in the same build, in this environment.pnpm buildpnpm testreports 302 passed and 2 failures, both pre-existing in an unrelated packagepnpm lintpnpm typecheckReview notes
rk_keysand mixed-case secret filenames are newly flagged, which is the point of both issues. No
exported type, function signature or default changed.
classifyFile.tsand is not listed anywhere in the docs.The tests are parameterised over the exact spellings in the issues, and include the negative
cases (
pk_live_is not flagged,docs/README.mdis still not a secret) and a positive case forthe dashed form, so the looser patterns cannot silently over-match or drop the old behaviour.