Repository navigation
IDE Wiring Map: open only a file the wiring graph reports (ASVS 5.3.2, BACKLOG #4277) - #3252
wshallwshall wants to merge 3 commits into
Conversation
The Wiring Map's "open" handler passed a webview message's file straight to messagefoundry.openSource, which opens any path. A page script names that file, so a compromised page could have the extension open any file the operator's account can read. graphOpenTarget (wiringMapModel.ts, vscode-free) now accepts the request only when the current graph reports that file for an element, compared with fileKey against the workspace root, and hands openSource the graph's own spelling of it. Anything else is refused with a warning and nothing opens. openSource itself is unchanged: its other callers pass a graph-reported tree-row path or the open document. Node-side tests: graph paths (absolute and workspace-relative) open; page-chosen paths, traversal, UNC and malformed requests are refused. BACKLOG #4277
…failures Review round 1. graphOpenTarget now requires the page's file to EQUAL a file the graph reports, rather than matching a resolved, case-folded key: the page only ever echoes the payload, and an exact match takes no dependency on the workspace root or on fileKey, whose contract says it is not a containment check. The open message's fields are typed unknown, an openSource rejection (a graph file gone since the last refresh) now warns instead of being dropped, and the tests no longer claim a UNC rule the guard does not have. A new test pins that every file the map payload offers is one the guard accepts. BACKLOG #4277
…able files Review round 2. The open handler's decision moves into handleOpenRequest (wiringMapModel.ts, vscode-free, host calls injected), so node-side tests now pin that a refused file runs no command and a graph file reaches messagefoundry.openSource under the graph's spelling. graphOpenTarget reads openable files through collectElements, the same source the payload is built from, so an empty file is excluded by construction. Drops the imports round 1 left unused, and the refusal warning now says when no graph is loaded. A mutation that disables the guard turns 4 of the 22 suite tests red. BACKLOG #4277
|
QA (Builder E1, BACKLOG #4277): code-review skill at xhigh, Rounds: 2 + 1 unrepaired. Tag for round-a2e7b4cc and round-844fe3d6, read with review_tag.py, exit 0: "xhigh effort -> 10 inline angles -> dedup (no verify) -> sweep -> <=15 findings". The tool did not echo a tag line for round-083e5def, the final unrepaired round. Unrepaired findings from the final round, shipped as the Builder reported them: |
|
Lander hand-over (Manager aebf32, batch 684)
Ledger ask after merge: flip #4277. Proposed banner, from the Builder, to carry as written: |
Merge danger
Reversible: yes -- reverting the squash on
mainrestores the previous Wiring Map open handler.Blast radius: the VS Code extension's Wiring Map webview open handler only (
ide/src/wiringMap.ts,ide/src/wiringMapModel.ts) and its unit tests. No engine package, API, store or pipeline change. Themessagefoundry.openSourcecommand and its other callers are unchanged.Evidence
origin/main353b2183fe2,ide/src/wiringMap.tspassed the page-postedm.filestraight tomessagefoundry.openSource, which opened it with no check.ide/src/test/suite/wiring-map-model.test.ts. A graph-reported path opens, absolute or workspace-relative. A page-chosen path is refused: traversal, near-miss, case variant, UNC, malformed input. Negative control: with the guard disabled, 4 of the 22 tests in that suite go red.npm run test:unit1968 passing, 0 failing on the final head.Batch 684, BACKLOG #4277 (Builder E1)
Source branch
b684-4277-opensource-guard, head37363340baeb19c606ea68a8a3f5c9f4c27de44b. Its own PR because it changes a security control.What changed. The Wiring Map open request now goes through
handleOpenRequest/graphOpenTargetinide/src/wiringMapModel.ts(no vscode import). The open is allowed only when the page's file exactly equals an element file the current graph reports, matched against the samecollectElementssource the payload is built from, so no root resolution or case fold can widen it (ASVS 5.3.2). A refused request runs no command and shows a warning that does not echo the path. A failed open (file deleted since the last refresh) now warns instead of being dropped. The message'sfileandlineare typedunknown.The guard is stricter than the row asked: the Wiring Map can no longer open the open document unless the graph reports it. The page never asks for that, so nothing regresses.
Checks run: ide
tsc --noEmitclean;npm run compileOK;npm run test:unit1968 passing, 0 failing on the final head (on an earlier head, one unrelatedcollectionCaseFilesjunction test failed in the full run and passed alone, a load-timing flake);tests/test_file_path_join_census.pygreen (18 passed), join counts unchanged. No Python changed, so ruff and mypy do not apply.Not run: the electron
npm testsuite.Deferred, out of scope:
setFocus,revealand a null message belong to BACKLOG Redactor masks the rest of a PHI value a field run cut through (BACKLOG #3318) #2418.revealandrefreshare still dropped byvoid onMessage.wiringMapWebview.ts, outside the brief.Review: code-review skill at xhigh, Rounds: 2 + 1 unrepaired. The QA line and unrepaired findings are in a comment below.