Skip to content

fix: narrow the private-file rule for hidden files, build output and lint - #7990

Merged
michaelwang11394 merged 2 commits into
mainfrom
sec-private-followups
Nov 17, 2026
Merged

michaelwang11394 merged 2 commits into
mainfrom
sec-private-followups

Conversation

@michaelwang11394

Copy link
Copy Markdown
Contributor

What

This follow-up to #7979 narrows the shared private-file rule (@hyperframes/parsers/private-path) in four ways:

  • A hidden file is private whatever its type. The asset-type exception now covers only files inside a hidden folder, so .secrets.js, .eslintrc.cjs and sub/.tokens.css are refused. Before this change, a hidden file with a script, style or picture extension was served.
  • Framework build output is private. Files in .next, .nuxt, .output, .svelte-kit, .vercel, .netlify, .wrangler, .astro and .turbo are refused for every file type.
  • Common credential file names are private: credentials.json, serviceAccountKey.json, service-account.json and service_account.json.
  • Lint stays out of private files. It skips private paths when it walks compositions/, and it refuses a private file named as its explicit entry.

Why

These are the review points left open on #7979.

  • A hidden file with a loadable extension is still a hidden file, and a tool can keep a token in one.
  • Build output can carry server environment values that were inlined at build time.
  • Service-account key files are usually not hidden, so the hidden-name rule never caught them.
  • Lint read every composition file, and it read a named entry, without asking the rule first.

Related work

Refs #7979

How

  • isStudioPrivatePath adds the build-output folder set, and it applies the asset-type exception only when the file's own name is not hidden.
  • CREDENTIAL_FILES gains the four names. Names are compared in lowercase, as before.
  • lintProject checks the explicit entry with isPrivateFileUnder, and the composition walk skips paths that isStudioPrivatePath refuses.

Test plan

  • Unit tests added/updated
    • core safePath.test.ts: the new refused paths. 153 tests pass.
    • lint project.test.ts: .git/m.json, .mcp.json and .hyperframes/share.json linked as an import map are never read; a hidden composition folder is never linted; a private explicit entry is refused. 109 tests pass.
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

The comment ratchet and oxfmt pass on the changed files.

…ips private compositions

Review follow-ups:
- Hidden framework build-output folders (.next, .nuxt, .output, .svelte-kit,
  .vercel, .netlify, .wrangler, .astro, .turbo) are private whatever the file
  type, since their scripts can carry inlined server environment values.
- credentials.json and common service-account key names are private.
- Lint's compositions/ walk skips private files and folders, and an explicit
  lint entry that is a private file is refused.
- New lint tests link .git/m.json, .mcp.json and a .hyperframes record as an
  import map; they fail when lint's private-file check is removed.
@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 121 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@eddy-heygen eddy-heygen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

(Eddy's agent) Reviewed by Eddy's Claude agent at commit a032550.

Verdict: approved, good to ship.

Summary. A follow-up that tightens the private-file rule: a hidden file is no longer treated as a loadable asset just because of its extension, framework build-output folders inside the project are private, a few more credential file names are listed, and lint refuses a private file as an explicit entry and skips private paths when walking compositions. I read the whole change (4 files). Each edit only makes the rule stricter; the media folder and the studio's own files keep their exceptions.

Blockers

None.

Non-blockers

  • A project that deliberately keeps a composition or a loaded script under one of the listed build-output folder names, or loads a dot-named asset file, will now have it treated as private. That looks intended; worth a line in the release notes.
  • The credential-file list is by exact lower-case name, so it stays a best-effort list; the hidden-file and folder rules do the main work.

CI: all checks pass at this commit (the rest are skipped by path).

How this was reviewed: I read the full diff and the helper it calls myself. Nothing was built or run.

@michaelwang11394
michaelwang11394 added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit f5ccfcc Nov 17, 2026
95 checks passed
@michaelwang11394
michaelwang11394 deleted the sec-private-followups branch November 17, 2026 17:39
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