Repository navigation
Conversation
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Check that ordinary files in a Windows tool call still show the side-panel file pill. [UX-REVIEWED] 08c24c1 Description read[DESCRIPTION-READ] bc186281639fcdc5c85e29d42d561f2b4bcba6189f2cfcd503befac202870766 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 08c24c1 Description read[DESCRIPTION-READ] 3618d437432f70093a73ba80e21fc6ce422b4ed3dad522a9de95bff994f49fc7 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check before merge: Not justified as shipped
What this change shipsInventory (4 items) — 3 justifiedIntent: Windows users should not see side-panel "open" controls or file probes for credential files or traversal paths, the same as POSIX users today. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 08c24c1 Description read[DESCRIPTION-READ] 46787f84c0d06eea54028603cd7a74c7f44fe092d609fa261a31c5590ee9c27a That sha256 names the PR description this verdict read. Recompute it with |
|
🤖 Kiro Crew [operator: chenmingwei23]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author. Assessment: Frontend-only diff (safePath). Backend Tests + Coverage Gate reds are inherited from main. Fix: rebase onto current main to clear the inherited backend reds; verify safePath tests pass. If you'd prefer I don't touch this PR, add the |
`isSafePath` gates three "open this file in the side panel" affordances: DiffBlock's Open button, ToolCallLine's file pill, and the app-sdk chat message list's file chip. It refuses parent traversals and credential locations -- .aws, .ssh, .env, .git, .kube and the rest. It split on `/` only. Two of the three consumers feed it the path a tool call actually operated on, taken from the tool's JSON input, so on Windows it arrives native: `C:\Users\me\.aws\credentials`. That is one segment, and every test in the guard compares whole segments, so no entry in the list could ever match and neither could `..`. Measured across seven sensitive paths plus a traversal: refused on POSIX, allowed on Windows, 7 of 7. The effect is that the Open affordance is offered for a credentials file and the existence probe fires for it -- the probe the DiffBlock suite describes as the guard's whole observable. The backend still refuses the read (`security.paths.is_sensitive_path` is Path-based and platform aware), so nothing is disclosed; what is broken is the defence in depth and the affordance the user is shown. Splitting on both separators fixes all three consumers at once, since they share this helper. DiffBlock is unaffected either way: its paths come from a git diff header, which is always `/`-separated. The guard stays segment-equality plus a `name.` prefix rule rather than a substring match, so `.envrc`, `.gitignore` and `my.env` are still allowed; the new suite pins that in both spellings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
3909ccb to
08c24c1
Compare
|
Verified current main versus head 08c24c1 using each production isSafePath source. Windows/UNC and relative/mixed traversal are red before and refused after; ordinary paths and all over-refusal controls stay allowed. Focused safePath + DiffBlock tests: 37 passed. ESLint, TypeScript/Vite build, docs lint and current PR description checker passed. Local GPT preflight found no blockers (requested gpt-6.1-sol; served model unverified). Local Opus was unavailable in this interface; the exact-head server Opus review remains authoritative. [
{
"name": "posix ssh",
"path": "/home/dev/.ssh/id_rsa",
"expected": false,
"before": false,
"after": false
},
{
"name": "windows ssh",
"path": "C:\\Users\\dev\\.ssh\\id_rsa",
"expected": false,
"before": true,
"after": false
},
{
"name": "unc ssh",
"path": "\\\\share\\team\\.ssh\\id_rsa",
"expected": false,
"before": true,
"after": false
},
{
"name": "posix traversal",
"path": "src/../secret",
"expected": false,
"before": false,
"after": false
},
{
"name": "windows traversal",
"path": "src\\..\\secret",
"expected": false,
"before": true,
"after": false
},
{
"name": "mixed traversal",
"path": "src/..\\secret",
"expected": false,
"before": true,
"after": false
},
{
"name": "ordinary",
"path": "C:\\Users\\dev\\src\\main.ts",
"expected": true,
"before": true,
"after": true
},
{
"name": ".envrc",
"path": "C:\\repo\\.envrc",
"expected": true,
"before": true,
"after": true
},
{
"name": ".environment",
"path": "C:\\repo\\.environment",
"expected": true,
"before": true,
"after": true
},
{
"name": ".gitignore",
"path": "C:\\repo\\.gitignore",
"expected": true,
"before": true,
"after": true
},
{
"name": "my.env",
"path": "C:\\repo\\my.env",
"expected": true,
"before": true,
"after": true
},
{
"name": "...",
"path": "C:\\repo\\...",
"expected": true,
"before": true,
"after": true
}
]
|
|
Thank you for this fix, @leonlaiyc! 🙏 To get it merged cleanly against current #16461 is fully green (all CI and review lanes, including PR Readiness) and references the backing issue #16493. Closing this one in favor of #16461. Thanks again for catching the Windows path-separator gap in the side-panel refusal! |
Problem / Motivation
Goal: Make the shared side-panel path refusal work for Windows and UNC paths as it already does for POSIX paths.
website/src/utils/safePath.tsrefuses paths that a side-panel "open this file"affordance must not offer — parent traversals, and credential locations (
.aws,.ssh,.env,.git,.kube,.docker,.npmrc,.netrc, …). Threesurfaces share it:
DiffBlock's Open button,ToolCallLine's file pill, and theapp-sdk
ChatMessageListfile chip.It splits on one separator:
Two of the three consumers hand it the path a tool call actually operated on —
extractToolFilePathreadspath/file_path/filePathstraight out of thetool's JSON input (
messageRenderers.tsx:179,ToolCallLine.tsx:626). On Windowsthat is a native path,
C:\Users\me\.aws\credentials, whichsplit('/')turnsinto one segment. Every check in the guard compares a whole segment, so no
entry in the list can match, and neither can
...Measured against the guard on
main— same file, two spellings:.aws/credentials.ssh/id_rsaproj/.envproj/.env.localproj/.git/config.kube/config../../etc/passwd(traversal)7 of 7. The guard is not weaker on Windows — it is inert.
Why it matters
What actually happens, stated precisely. The backend still refuses the read:
security.paths.is_sensitive_pathisPath-based with a documentedsymlink/casefold matching contract, not string splitting, so it holds on Windows.
Nothing is disclosed by this bug. I checked that before writing this, because
the alternative framing would have been alarming and wrong.
What is broken is the layer in front of it, in two ways:
.aws\credentialsor.envtool-call pill. The product's own answer to "maythis be opened?" is yes, and only a later server refusal says otherwise.
DiffBlock's existing suite states the guard's observabledirectly — "the guard's observable is that the existence probe never fires" —
and on Windows it always fires, sending the sensitive path to
/api/file-readon every render of such a pill.
A defence-in-depth guard that silently does nothing on an entire platform is worth
fixing on its own terms: it is the layer that is supposed to still be standing
when something behind it is wrong.
The traversal half has the same shape and no separate justification needed.
Not a goal
What changed (motivation → approach → change)
The side-panel guard misses Windows-sensitive segments because it splits only on
/.website/src/utils/safePath.tssplits on both separators so the existing traversal and sensitive-segment rules run on native Windows, UNC and mixed paths. Segment equality and thename.prefix rule stay intact. The frontend conventions document records the shared owner and its contract.Current main still has the defect. Sibling #10667 is closed without merging and changes a separate file-explorer warning predicate; it has not completed this guard's work.
normalizeWindowsPathonly handles drive/UNC absolute paths, so it would leave relative backslash traversals unchecked and is not the right owner for this predicate.Backwards compatibility
Breaking: previously offered Windows-sensitive and traversal file-open actions are refused, matching the existing POSIX refusal contract. Writer/consumer sweep on origin/main @ 296969b:
Reader: website/src/components/DiffBlock.tsx:isSafePath -- entry: chat -- both the probe and Open action use the shared guard; ordinary diff paths stay allowed.
Reader: website/src/pages/chat/ToolCallLine.tsx:isSafePath -- entry: chat -- tool-file probe gating uses the shared guard; ordinary native paths stay allowed.
Reader: website/src/app-sdk/messageRenderers.tsx:isSafePath -- entry: app -- extractToolFilePath returns null for refused paths; ordinary file chips stay allowed.
Tests
37 tests pass in safePath.test.ts and DiffBlock.test.tsx. The helper tests pair POSIX and Windows sensitive paths, cover UNC and relative/mixed-separator traversal, and retain ordinary-file and over-refusal controls (.envrc, .environment, .gitignore, my.env, ...). Focused ESLint passes. The local Vite test wrapper only permits the shared dependency junction's resolved path; it is not committed.
Manual verification
Verified the refetched main's shared guard and all current consumers. Windows and UNC sensitive paths plus both traversal spellings are refused by the branch. Ordinary paths and the over-refusal controls remain allowed. No consumer is patched.
Screenshots / video
N/A: this diff changes the shared path predicate and regression tests, without adding a frontend surface, string or layout. Existing consumer tests verify the omitted Open action and absence of a sensitive-file probe; the established POSIX presentation is preserved on Windows.
Related Issues
Closes #16493
The existing issue describes this exact defect. It has bug and area: dashboard labels but no recognized triage verdict; maintainer triage is required. No new issue or verdict label was created.
Pattern harvest
Rule candidate: review-prompt
Pattern: a segment-based guard over tool-produced native paths must test both separators, including relative traversal, and retain over-refusal controls.
Checklist
Contribution License Agreement