fix(oxlint-plugin): allowlist public client keys in no-secrets-in-client-code#612
Merged
Conversation
…ent-code Vendor publishable keys (RevenueCat appl_/goog_/amzn_/strp_, Stripe/Clerk pk_, Supabase sb_publishable_, PostHog phc_, Stytch public-token-, Mapbox pk.) are designed to ship in the browser, so short-circuit before both detectors instead of reporting them as hardcoded secrets. Ambiguous shapes (AIza browser keys, bare Supabase JWTs) stay flagged. Co-authored-by: Cursor <cursoragent@cursor.com>
Comment-only: keep the non-obvious rationale (public vs secret prefix, excluded ambiguous shapes) and drop verbose/duplicated prose. No behavior change. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
React Doctor found 4 files changed in this pull request, but none matched the files covered by its enabled checks. Scope: 4 files changed on Generated by React Doctor. Questions? Contact founders@million.dev. |
commit: |
This was referenced May 31, 2026
Merged
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.
Why
no-secrets-in-client-codeflagged public, client-safe SDK keys (e.g. RevenueCatappl_…) as hardcoded secrets.These keys are designed to ship in the browser bundle — RevenueCat / Stripe / Supabase / etc. publishable keys carry a type-identifying prefix that is distinct from the vendor's secret key. The rule's variable-name heuristic matches on the variable name (
apiKey,token, …) regardless of the value, so an intentionally-public key in a client file was reported as a leak.Before — reported
Possible hardcoded secret in "revenueCatApiKey":After — no diagnostic (
appl_is a known public client-key prefix):What changed
PUBLIC_CLIENT_KEY_PATTERNSto the plugin's security constants (sibling ofSECRET_PATTERNS).no-secrets-in-client-codeshort-circuits before both detectors (variable-name heuristic and secret-shape patterns) when a literal matches a known public prefix.appl_/goog_/amzn_/strp_, Stripe/Clerkpk_(live|test)_, Supabasesb_publishable_, PostHogphc_, Stytchpublic-token-(live|test)-, Mapboxpk.eyJ.AIza…(same shape as unrestricted server keys) and bare Supabaseanon/service_roleJWTs (eyJ…, indistinguishable by shape).sk_test_secret beside a public key is still flagged.react-doctorpatch.Eval results
RDE not run. This change only narrows the rule — it suppresses findings for specific public-key value prefixes and cannot emit new diagnostics — so there is no false-positive surface to sweep; the RDE harness/manifests aren't set up in this worktree. Can run it on request.
Test plan
vp test run tests/regressions/no-secrets-in-client-code.test.ts— 31 passed (2 new)pnpm test— 7/7 tasks, 1422 passedpnpm typecheck— 8/8pnpm lint/pnpm format:check— cleanpnpm smoke:json-report— OKMade with Cursor
Note
Low Risk
Narrows lint diagnostics only; does not weaken detection for known secret prefixes or ambiguous Google/Supabase shapes.
Overview
The
no-secrets-in-client-coderule no longer reports literals that match known public, browser-shipped key prefixes (RevenueCatappl_/goog_/etc., Stripe/Clerkpk_live_/pk_test_, Supabasesb_publishable_, PostHogphc_, Stytchpublic-token-, Mapboxpk.eyJ…). A newPUBLIC_CLIENT_KEY_PATTERNSlist is checked before both the variable-name heuristic and secret-shape detectors, so names likerevenueCatApiKeystop producing false positives when the value is intentionally public.Ambiguous shapes stay flagged: Google/Firebase
AIza…and bare Supabase JWT-styleanon/service_rolevalues. Regression tests confirm allowlisted keys are silent and real secrets (e.g.sk_test_) still fire when mixed with public keys.Reviewed by Cursor Bugbot for commit 438dc22. Bugbot is set up for automated code reviews on this repo. Configure here.