Skip to content

fix(tech-detect): validate Clerk publishable keys (#1481 adopted) #1478 - #1482

Closed
nc9 wants to merge 3 commits into
mainfrom
fix/clerk-publishable-key-1478
Closed

nc9 wants to merge 3 commits into
mainfrom
fix/clerk-publishable-key-1478

Conversation

@nc9

@nc9 nc9 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Adopts #1481 (William, #1478: a Stripe publishable key was mistaken for Clerk) by cherry-pick with authorship preserved, plus two maintainer commits. Refs #1478 (the issue is checked against its acceptance criteria after release); #1481 and the overlapping draft #1479 are closed with the new SHAs after the release.

Commits

Commit Author What
fix(tech-detect): validate Clerk publishable keys (#1478) (705be87c) William (Ching-Wei Kang) the key body is decoded and must be a Clerk Frontend API host (clerk. host ending in $); tests
test(tech-detect): update Clerk bundle fixtures (#1478) (2b756c14) William the real-build fixture key (tech-bundle-real-build-1254) and the secret-scan allowlist comments; without it 4 tests in that file fail under the stricter check
fix(tech-detect): clerk keys: build test keys at run time, allow short hosts, add base64url, unpadded and malformed-body cases #1478 maintainer tests rebuilt with run-time keys and the host list from #1479; the body floor goes from 20 to 12 characters so short real hosts such as a.clerk.x.com$ still match (the test fails with 20); new negatives (no $, bytes after $, a host without clerk., Stripe bodies that contain base64 of "erk"/"cler"); docs sentence

Comparison with #1479

#1479 only checks that a short base64 fragment of clerk appears somewhere in the body, so it still matches a Stripe-shaped body containing such a fragment, a decoded host with no $, and trailing bytes. #1481 decodes and validates. Both stay linear on 1 MB hostile inputs (3 to 20 ms, no per-candidate allocation beyond 200 characters).

Checks

tsgo clean in tech-detect; cli format:check and lint clean; detect-secrets clean; docs make validate; all 17 tech-detect test files by path, 0 fail (clerk 5, bundle-content-1254 54, pattern-bounds 5, klaviyo 11) and audit-engine tech-bundle-real-build-1254 11; CHANGELOG guard clean. No skill, workflow, rule-id or package.json change. No version bump: draft for the v0.0.154 batch.

@WilliamK112

Copy link
Copy Markdown
Contributor

The four Clerk failures in the audit-engine job come from stale synthetic keys in packages/audit-engine/tests/tech-bundle-real-build-1254.test.ts: their repeated base64 body decodes to bytes after the required closing $. I pushed a focused follow-up as WilliamK112/squirrelscan commit 2b756c14; it builds one valid Clerk key at run time and reuses it in all four fixtures. The focused tech-detect plus real-bundle suite passes 14/14. The remaining per-host throttle timing failure is unrelated.

WilliamK112 and others added 3 commits November 1, 2026 13:59
Signed-off-by: Ching-Wei Kang <[email protected]>
(cherry picked from commit 705be87)
Signed-off-by: Ching-Wei Kang <[email protected]>
(cherry picked from commit 2b756c1)
…t hosts, add base64url, unpadded and malformed-body cases #1478

Signed-off-by: Nik Cubrilovic <[email protected]>
(cherry picked from commit 85156fd)
@nc9

nc9 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.155 as 51027b0b, d9319e20, ac6cc368 via #1503.

nik

@nc9 nc9 closed this Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants