Skip to content

fix: scope client secret diagnostics#252

Open
aidenybai wants to merge 19 commits into
mainfrom
fix/no-secrets-client-scope
Open

fix: scope client secret diagnostics#252
aidenybai wants to merge 19 commits into
mainfrom
fix/no-secrets-client-scope

Conversation

@aidenybai
Copy link
Copy Markdown
Member

@aidenybai aidenybai commented May 15, 2026

Summary

  • Avoid weak secret-name reports in config, test, server, and tooling files so build-time fallbacks like Vite config constants do not show as client-code leaks.
  • Replace hardcoded Next.js env guidance with framework-aware public env prefixes for Vite, TanStack Start, CRA, Gatsby, and Next.js.
  • Add regressions covering Vite help text and the vite.config.ts false positive.

Test plan

  • nr build
  • nr test -- rule-messages
  • nr typecheck

Note

Medium Risk
Changes the no-secrets-in-client-code rule’s detection heuristics and file classification, which can materially change which projects/files get flagged (potential false negatives/positives). Adds new oxlint settings plumbing (framework/root) that, if mis-set, could affect rule behavior across scans.

Overview
Tightens no-secrets-in-client-code so the variable-name heuristic only runs for files classified as client-exposed, avoiding noisy reports in config/tooling/test/server contexts while still flagging known secret-value patterns everywhere.

Adds framework-aware help text for this rule (e.g. NEXT_PUBLIC_* vs VITE_*/REACT_APP_*/GATSBY_*) by passing project.framework and a realpathed rootDirectory into oxlint settings, and using them both for recommendation text and file-exposure classification.

Introduces new utilities (classifySecretFileExposure, isInsideServerOnlyScope, getIdentifierTrailingWord, plus expanded security path patterns) and a large regression suite covering these cases across Next.js/Vite/Expo/TanStack and common directory/file naming conventions.

Reviewed by Cursor Bugbot for commit 414a840. Bugbot is set up for automated code reviews on this repo. Configure here.

Avoid reporting weak secret-name heuristics in config and tooling files, and render framework-specific public env guidance so non-Next.js projects get actionable output.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-doctor-website Ready Ready Preview, Comment May 15, 2026 2:18pm

@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 15, 2026

🔴 React Review0/100 (unchanged) · No new issues

Reviewed by react-review for commit 414a840. Configure here.

Extend the weak client-secret heuristic boundary to common server and tooling paths while keeping exact secret-shape detection active, and move recommendation helpers into focused utilities.
Comment thread packages/oxlint-plugin-react-doctor/src/plugin/constants/security.ts Outdated
Require rc config filenames to be explicit so normal source files like src.ts still use the weak secret-name heuristic.
Add regression coverage that explicit rc config files remain outside the weak client-secret name heuristic while regular src.ts files still report.
Keep client API helpers covered while making the server-only heuristic exclusions easier to audit.
aidenybai added 2 commits May 15, 2026 02:03
Format the inherited TODO tracker so PR merge-commit checks can pass.
Gate the weak secret-name heuristic on explicit client exposure while keeping high-confidence secret values active everywhere.
Lock down client, server, ambiguous-source, and App Router cases for the client-secret heuristic.
Use detected framework settings to avoid path-only client exposure guesses for app directories and server-owned source roots.
Classify use-server modules as server code so client-path heuristics do not report server action constants.
Cover mixed server-only scopes, server-owned source roots, and additional client entry shapes so the weak secret heuristic stays scoped to bundled client code.
Classify secret exposure from project-relative paths and gate Next-only route heuristics so explicit client signals win over broad server path names.
Avoid weak secret-name diagnostics for UI copy and storage-key prefixes found during evals while preserving client secret fallback coverage.
Bring the PR up to date with main and keep the oxlint output parser changes compatible with the new batched scan retry flow.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4f4db99. Configure here.

Keep camel-case apiKey variables eligible for the weak secret heuristic while retaining UI text and storage prefix suppressions.
aidenybai added 2 commits May 15, 2026 07:13
Keep the new prerelease metadata from main aligned with the repository formatter so CI can pass on the PR merge commit.
Bring the PR up to date with the latest prerelease metadata and keep the changeset state formatted after the merge.
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.

1 participant