Skip to content

fix(cli): publish and cloud render staging skip other computers' network shares - #7858

Merged
michaelwang11394 merged 3 commits into
mainfrom
sec-publish-unc-1115
Nov 15, 2026
Merged

michaelwang11394 merged 3 commits into
mainfrom
sec-publish-unc-1115

Conversation

@michaelwang11394

Copy link
Copy Markdown
Contributor

What

publish and cloud render (including --dry-run) no longer open a path on another computer's network share, or a Windows device path, while they stage a project. A reference such as \\host\share\clip.png in an HTML or CSS file is now left out of the upload and reported with a new left-out reason, network_share. A page that came in with an imported project now has its references outside the project left out before the files they name are checked.

Why

On Windows, even checking whether a path like \\host\share\x.png exists makes the system connect to that host and send it the user's sign-in. Staging resolved every reference in the project's HTML and CSS and then checked the file on disk. That check ran on share paths however they were written: with backslashes, mixed separators, percent-encoding, or a \\?\ or \\.\ device prefix. It also ran before the check for pages that came in with an imported project, so a received page could make the CLI reach out to any host it named.

Related work

Refs #7830, which edits other parts of publishProject.ts. The two PRs merge cleanly in either order. This uses the same rule as #7849, which made the received-render check skip other computers' shares.

How

  • archiveTargetOf first asks namesAnotherNetworkRoot (from @hyperframes/parsers/asset-resolution) whether the resolved path is on another network root. If it is, the reference is left out with the network_share reason and nothing on disk is touched. A file on the same share as the project still counts as local and is copied as before.
  • The check for a page that came in with an imported project now runs before any exists or stat call on the outside path.
  • A filesystem reference's ?query is now split off after the path's root, so the ? in a \\?\ device path is no longer mistaken for the start of a query.
  • outsideFileReference, which builds the left-out report, no longer resolves links on a path that is on another computer's share, because that would also connect to it.
  • LeftOutReason and its warning text in studio-server gain network_share. The warning reads "which is on another computer's network share or is a Windows device path".
  • The CLI docs list the new reason and describe the behavior.

Test plan

  • New publishProject.networkShare.win32.test.ts runs staging under path.win32 rules with a fake disk that records every path it is asked about. It covers the publish staging path (buildPublishFileMap), the cloud render and --dry-run path (stagePublishFiles with an on-disk threshold and an entry page), and createPublishArchive. For each, it checks that:

    • no exists, stat, open or realpath call reaches a share or device path, for ten spellings plus srcset and CSS url();
    • each such reference is reported as left out with the network_share reason;
    • local files outside the project, on the same drive and on another drive, are still uploaded;
    • a file on the share the project itself lives on is still uploaded.
  • A further case shows that a page listed in the received-files record has its outside references left out without an exists, stat or open call on them.

  • 10 of the 13 new tests fail on the base commit; the 3 that pass there are the same-share cases, which guard against a regression.

  • The existing publish, cloud render, received-render, left-out and offload suites pass. One Unicode file-name test in publishProject.test.ts fails on macOS with and without this change, because APFS treats both Unicode forms as the same file.

  • tsc --noEmit passes for packages/cli, packages/studio-server and packages/producer. The comment ratchet and the pre-commit hooks pass.

  • Unit tests added/updated

  • Manual testing performed

  • Documentation updated (if applicable)

  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

publish and cloud render now leave out a reference to another computer's
network share or a Windows device path before any file-system call on it,
and report it as left out with the network_share reason. A page that came
in with an imported project has its outside references left out before the
files they name are checked.
@mintlify

mintlify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 15, 2026, 8:01 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 84 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)

Unstable (1)

  • seqab-none-center-r0-root-z100: tracking 0.03, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.03, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.03, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 43adb294d042a1f17847b2448747ddb242e7fb86.

The direct network/device-root check precedes target inspection in archiveTargetOf, and the report builder avoids resolving those targets. Publish, cloud staging and feedback archives share this path. Local-drive and same-share controls remain supported. An automatic merge-tree comparison with the current overlapping staging change has no textual conflicts; reading the combined code also preserves its downstream referenced-file exclusions.

Pre-existing follow-up: leftOutReference.ts:37 still resolves local outside targets while reporting a received-page refusal. The new test deliberately excludes realpath from that assertion. Keep this as a bounded direct-path fix, not a guarantee that all rejected targets incur no filesystem access. A lexical-only report for the received reason would remove that remaining lookup.

Evidence: frozen install and full workspace build passed. The 92 committed tests selected across network-share staging, publish and left-out reporting pass. An additional stricter received-report control fails on the remaining realpath calls described above. Restoring the two changed CLI implementations to the base makes 10 of the 13 new tests fail; the three same-share controls still pass. Windows path rules were simulated on Linux; no native Windows or live upload was run.

Need: yes · Size: ok · Reuse: shared namesAnotherNetworkRoot and staging pipeline · Simpler: already minimal · Structure: fine (checked archiveTargetOf, reporting and the three command callers; no split)
Risk: medium — upload staging changes while preserving same-share and local-drive behavior.

Verdict: APPROVE
Reasoning: Direct network/device-root targets are rejected before target inspection or resolution in the shared archive path. This is a bounded fix: the broader no-target-access claim for received-page reporting is not fully met, but that lookup predates this patch and remains a follow-up.

— Rames

@michaelwang11394
michaelwang11394 added this pull request to the merge queue Nov 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 15, 2026

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 61e99e0956f13123f9f9d2a5a8c678d8a6a10ed6, delta since 43adb294d042a1f17847b2448747ddb242e7fb86.

The merge commit is exactly Git's automatic merge tree (29ba9658d99c48273443b8a672af2826163dbcd3), with no manual resolution delta. The PR's three production files are byte-identical to the previously reviewed head. The only follow-up change is the test mock's lstatSync: a missing entry returns undefined when throwIfNoEntry: false, matching the new received-record caller; normal missing-entry calls still throw. This prevents the mock from turning an absent record into an unreadable one.

Validation: reconstructed the merge tree, compared production blobs, read the full fixture and the incoming received-record logic. This was a static delta review; no new local test or native Windows run was performed. Reporting received-file refusals still resolves local outside paths; this predates the patch and remains a nonblocking follow-up.

Need: yes · Size: ok · Reuse: native lstat option contract · Simpler: already minimal · Structure: fine (checked mock and recordKind consumer; no split)
Risk: low — merge plus a narrowly scoped test-double correction.

Verdict: APPROVE
Reasoning: The merge preserves the reviewed guard, and the mock correction restores filesystem-contract parity without weakening assertions.

— Rames

@michaelwang11394
michaelwang11394 added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit c030e31 Nov 15, 2026
86 checks passed
@michaelwang11394
michaelwang11394 deleted the sec-publish-unc-1115 branch November 15, 2026 20:37

This branch was successfully deployed

1 active deployment
staging - docs — 61e99e09 Deployed Nov 15, 2026 by mintlify[bot]
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