Repository navigation
fix(cli): publish and cloud render staging skip other computers' network shares - #7858
Conversation
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.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Edit accuracy: accurate 267 (base branch 267), smooth 84 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
jrusso1020
left a comment
There was a problem hiding this comment.
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
jrusso1020
left a comment
There was a problem hiding this comment.
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
What
publishandcloud 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.pngin 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.pngexists 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
archiveTargetOffirst asksnamesAnotherNetworkRoot(from@hyperframes/parsers/asset-resolution) whether the resolved path is on another network root. If it is, the reference is left out with thenetwork_sharereason and nothing on disk is touched. A file on the same share as the project still counts as local and is copied as before.existsorstatcall on the outside path.?queryis 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.LeftOutReasonand its warning text instudio-servergainnetwork_share. The warning reads "which is on another computer's network share or is a Windows device path".Test plan
New
publishProject.networkShare.win32.test.tsruns staging underpath.win32rules with a fake disk that records every path it is asked about. It covers thepublishstaging path (buildPublishFileMap), thecloud renderand--dry-runpath (stagePublishFileswith an on-disk threshold and an entry page), andcreatePublishArchive. For each, it checks that:srcsetand CSSurl();network_sharereason;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.tsfails on macOS with and without this change, because APFS treats both Unicode forms as the same file.tsc --noEmitpasses forpackages/cli,packages/studio-serverandpackages/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