Repository navigation
Conversation
This was referenced Oct 30, 2026
nc9
force-pushed
the
fix/1283-1227-secrets-placeholders
branch
4 times, most recently
from
November 1, 2026 13:06
52cf418 to
ddfe96d
Compare
4 tasks
nc9
force-pushed
the
fix/1283-1227-secrets-placeholders
branch
4 times, most recently
from
November 1, 2026 18:47
d479555 to
ea36d4b
Compare
…rs, docs passwords, base64 A runs, asset names; labels Paystack keys #1283 #1227 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/1283-1227-secrets-placeholders
branch
from
November 1, 2026 19:54
ea36d4b to
3dcfdde
Compare
Merged
Contributor
Author
|
Landed in v0.0.158 as nik |
nc9
added a commit
that referenced
this pull request
Nov 5, 2026
…truncateToBytes #1298 Signed-off-by: Nik Cubrilovic <[email protected]>
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.
Fixes #1283
Fixes #1227
False-positive cluster in
security/leaked-secretsfrom the 38k-site corpus triage. Every silenced class has a paired real-shaped control that still reports, and a megabyte-scale adversarial timing test.What changes
sub1234567890,nameJohn Doe,iat1516239022, optionaladmin: true) and its HMAC verifies under a published sample secret (your-256-bit-secret,secret, ...). Any other claim or value, or any other signature, is read like any other token.data:payload, not next to/+unless handed over afterBearer/Authorization/token/key(includingBearer+), not mostlyA, needs a real tail, max 200 chars.neon_<hash>.png,sk-<hash>.svg,key-<hash>.webp,re_<hash>.woff2) are file names, for the four low-specificity prefixes only (Neon, legacy OpenAIsk-, Mailgunkey-, Resendre_).sk-ant-,AIza,SG., GitHub and Stripe tokens followed by an extension still report.DOIBAN is not a Spaces key. A lowercase slug after a vendor word is not a token unless it is the value of a credential-named assignment.sk_live_/sk_test_+ exactly 40 hex =Paystack .... Other hex-only tails of 32+ chars: unknown-provider key, medium inside adata-*-key/data-*-tokenattribute whose name has no secret/private/server/admin/master, high everywhere else.\n,\u000a,%0A, , ,<br>/<p>/<div>, quotes, commas,+,.concat(,.join(, spaces, armor headers). Prose, code or another-----marker between means prose. (The first version of this PR said 60+ characters; the code and docs now say 32.)s3cret,password123,examplepassword) onlocalhost/loopback/.localhost/.test/.example/.invalidwith nohost=/hostaddr=override is dropped..internaland.localare NOT unroutable and do not qualify. A password that is itself a template placeholder (${pass},{{ pass }},{password},%s,%(pw)s) is dropped; a hard-coded password beside a templated host/user, or containing%s/%D0/{abc}, reports.exampleis a placeholder only asexample+ a credential noun (+ short number):example-password,example_secret.Example1234,ExampleKeyreport.Deliberately not done
changemeands3cretas bare generic values stay reportable: an existing corpus negative pinschangemeas "as often a real default credential as a placeholder". Only the connection-string case (docs password on unroutable host) uses the leet/word list.*.internaletc. with a random password stays high: that is a real prod credential shape.Test changes
Existing fixtures used the Stripe sample tail and header-only PEM strings; they now use a different tail and a PEM with a body. The harness
escapeJsBodyno longer escapes thenof a\n(its own doc comment said it left those alone).Verification
bun teston the 7 leaked-secrets files by path: all pass (2308 + 158 + 28). Before the change 13 of the 28 new tests fail.squirrel auditon a local fixture page (8 false-positive snippets + a neon png): none reported; 5 real-shaped controls (PEM with body, strong-password pg URL, othersk_test_, admin JWT, Paystack live) plus the widget key all reported.tsgo --noEmitin packages/rules,make validatein docs, detect-secrets hook on the changed files: clean.Rule count/catalog unchanged (no new rule; two new report type labels). Skill change: none needed.
Bypass probes and results (review-pub-secrets findings and my own)
Every row is a test in
leaked-secrets-samples.test.ts.["hdr","<64>","<64>"].join("\n")(double and single quotes, no spaces),"..\n".concat("<b64>"),<br>,<br />,<p>/<div>per line,\n,\r\n,\u000a,%0A, , , spaces, one-line blob," + "joins, armor headersvar id="<40 base64>", code, another header, elidedMIIE...,<p>Copy it now</p><p>run</p>@${DB_HOST},@{host},${user}user,%s,%D0x,{abc}inside the password.internal,.local,.svc.cluster.localhosts;CompassRoseAtlas,Bypassing,TesterBob,Rootsalton localhostAuthorization=Bearer+AAAA...,access_token=AAAA...=, header form+and=. Fixed. All reportsk-ant-,AIza,SG.tokens followed by.css,.map,.png,.svg,.woff2data-secret-key,data-private-key,data-server-token,data-admin-keywith a hexsk_live_cloudflareToken:"correct-horse-battery-staple-token-value"and a slug under a credential keyiss/exp/otheriat/admin:false/missingname, signed with a published secret; sample +scope/role/permissions; minted admin token with real secretexampleplaceholderExample1234,ExampleKey,example123,Example-Corp,ExampleCorp#2024!.svg/.pnglocalhost/db?host=prod,hostaddr=,localhost@real-host,localhost.acme-prod.net\u0041-escaped bearer, zero-width before a PEM bodyPASSWORD:'EXAMPLE-PASSWORD'is a placeholder (case-insensitive by design);exa\u200bmple-passwordreportsComposition with #1228 (landed via #1241): in main; passes in the full run. Compose with #1277: only CHANGELOG and
.secrets.baselineconflict.Later review rounds
Note: keep it safe+ a 40-char base64 runword:text counted as an armor header). Fixed: onlyProc-Type,DEK-Info,Version,Comment,Hash,Charset,MessageIDlines are skipped; the prose stays dropped, the armored key reports{Xk9mQ2...}){name}accepted any name). Fixed:{name}is lower-case snake only; the braced random password reportsFinal review round
header + A x31,header + <br><br><p>: 2.1-3.1 s before. The search now reads at most 600 characters per header and stops at the first-----: 72, 79 and 36 ms. Counter-based tests assert the examined characters per header (a work counter, not wall time)<td>,<b>,<i>, highlighter<span class="line" data-line=... style=...>); tests for bothsk-, Neon, Mailgun and Resend tokens are skipped only after/, a quote,(,=or a comma, and only for image/font/media extensions..mapand.css, and a token followed by.pngin running text, reportadminroot) on localhost/.test/.example/.invalidis treated as the example it almost always is; a bare/- or+-adjacent bearer with noBearer/Authorization/token/keybefore it is not matchedRebase 2026-11-01
Rebased on main (v0.0.156, 99f63d3) as part of the stack 1298 -> 1300 -> 1318 -> 1319 -> 1320; CHANGELOG bullets re-inserted under [Unreleased];
.secrets.baselineline numbers refreshed (no new entries). Draft: corpus A/B pending.Review round
...ends them, several short chunks must mix case and digits, the gap before the body stays bounded at 400 raw characters. Elided and prose cases stay silent. A+inside a body is base64, a+between literals is a join.<pre>/<code>on docs-like pages downgraded to info) is DESCOPED, not implemented: a live-shaped key pasted in a docs block is a real leak. The acceptance criteria are amended by lane-review-prs.isLowercaseSlugremoved: with it off, every suite passes and a 24,000-shape differential (slugs under brand keywords in six embeddings) produced identical findings on and off, so main already ignored its input; the docs "Slugs" bullet is gone.every, both Stripe sample tails, bounded PEM gap, percent-encoded line breaks,example-*digit cap and anchoring, hex tail minimum, docs-password length cap, query-parameter password, jwt.io name check.Skill change: none.
Delta review leftovers
+and/satisfying it, a word or non-base64 token ending the body, and filler between chunks (the 400 gap applies before the first chunk only; the 600-character read bounds the whole). 8 of 8 mutants fail a test.Skill change: none.
Twitter bearer false negative fixed
A public-format app-only bearer (21 or 22
A, then%2B,%2F,%3Dsegments, about 118 characters) was no longer detected in assignment, bare-string, URL-parameter and attribute contexts: the page's percent-escapes were decoded first, which cut the token at its first+,/or=, and the plausibility check read a stub.decodePercentRunnow leaves a run holding that shape (19+Anot preceded by a letter, digit,+or/, a token and a percent-escape within 200 characters) as written, so the pattern and its checks read the whole token. Base64Aruns stay dropped; an encoded document with a blob inside is still decoded. Tests: the 19/21/22/24-A encoded token in six contexts, the unencoded 19-A cases, and the encoded-document control; mutants (no skip, no lookbehind, A-run length, tail bound) fail a test.Skill change: none.