Skip to content

fix(files): stop executing outside-workspace file links and block UNC paths before disk access - #294

Merged
Hona merged 9 commits into
devfrom
browser-ui/sec-a1-file-links
Nov 20, 2026
Merged

Hona merged 9 commits into
devfrom
browser-ui/sec-a1-file-links

Conversation

@Hona

@Hona Hona commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What was wrong (in published 0.0.0-dev-440 efc20a22)

Four local execution and credential-leak issues were present in the published 0.0.0-dev-440 build (efc20a22, 19 Nov):

  • Outside-workspace file links (features/files/src/links.rs:380, since e2b712c8, 1 Nov): Clicking a chat Markdown or terminal link outside the session folder called Path::exists() (initiating an outbound Windows SMB handshake and leaking NTLMv2 hashes on UNC paths) and then open_in_default (explorer.exe <path> / /usr/bin/open <path>), running .bat/.cmd/.lnk/.exe on one click.
  • Timeline & Markdown image right-click Open (crates/session-view/src/images/drag.rs:102,121 since 067685b5, 7 Nov; menu.rs:121-129 since f3f8d1fd, 8 Nov): Non-PNG/JPEG/GIF/WebP images (e.g. BMP, SVG, ICO, AVIF) kept the attacker-supplied URL/attachment extension (.bat/.hta/.cmd) in %TEMP%\opencode-drag\, and right-click Open ran bare explorer / /usr/bin/open / xdg-open.
  • Windows Terminal ; injection (features/open-in/src/windows.rs:41, since f1faf1c8, 12 Nov): Passing an unescaped repository folder name containing ; to wt -w new -d <dir> let wt.exe split subcommands even inside quoted arguments.
  • macOS bundle launch (features/open-in/src/lib.rs:155 since 2e854fe5, 30 Oct; apps/desktop/src/shell/view/location_card.rs:329 since cd697837, 8 Nov): Bare /usr/bin/open <path> (without -R -- or symlink/bundle checks) could launch a .app or unlisted bundle directory.

What changes (by area)

1. Shared lexical & OS local-path verifier (crates/browser-policy/src/{local_path.rs, local_fs/*, workspace_root.rs, lib.rs}, apps/browser-engine/src/preview/handle_path.rs)

  • Lexical refusal before any disk touch: is_raw_unc_href, is_unc_or_device_path, and safe_local_reveal_path reject UNC/SMB (\\, //, file://host/..., file:///\\..., file://localhost/\\..., percent-encoded %5c/%2f UNC forms, mixed \??/ and /??\, WebDAV), Win32/NT device namespaces (\\?\, \\.\, \??\), drive-relative paths, NTFS alternate data streams, control/bidi/BOM prefixes, .., and Unix autofs prefixes (/net, /Network, /misc, /afs, /run/user/*/gvfs). : and Windows DOS device stems (con, aux, nul, etc.) are scoped to Windows paths so valid Unix filenames stay intact.
  • Shared Windows reparse-tag allow-list (is_allowed_local_reparse_tag): Rejects every name-surrogate/redirecting tag (bit 29: symlinks 0xA000_000C, junctions/mount points 0xA000_0003, WSL symlinks 0xA000_001D, global reparse 0xA000_0019), APPEXECLINK, and unknown tags; allow-lists only non-redirecting local tags (IO_REPARSE_TAG_CLOUD* / legacy IO_REPARSE_TAG_ONEDRIVE for Windows 11 OneDrive Known Folder Move and Cloud Filter folders, IO_REPARSE_TAG_WOF where unprivileged WOF_PROVIDER_FILE decompresses only the file's own stream and WIM overlays require Administrator, and IO_REPARSE_TAG_DEDUP whose volume ChunkStore requires Administrator). Wired identically into both crates/browser-policy/src/local_fs and apps/browser-engine/src/preview/handle_path.rs.
  • Lexical vs local workspace root checks (workspace_root.rs, apps/desktop/src/surfaces/browser/mod.rs, apps/browser-engine/src/engine.rs): is_safe_workspace_root remains strictly lexical (no disk/network I/O) so cross-OS remote workspace roots (e.g. remote Linux /remote/work evaluated on Windows) and oc-preview:// callers are unaffected. Known-local callers (browser_file_roots, engine safe_roots, path_within_root) use is_safe_local_workspace_root, which verifies the local root fail-closed via verify_local_path and compares home/system suffixes case-insensitively on both Windows and macOS (cfg!(any(windows, target_os = "macos"))).
  • Authoritative OS verification (verify_local_path, verify_within_root, is_macos_bundle, reveal_in_file_manager):
    • Windows: QueryDosDeviceW (refusing subst-to-UNC, network redirectors, and recursive subst-to-junction chains) -> GetDriveTypeW == DRIVE_FIXED -> component-wise FILE_FLAG_OPEN_REPARSE_POINT walk inspecting GetFileInformationByHandleEx(FileAttributeTagInfo) -> GetFinalPathNameByHandleW confirming local \\?\<drive>:\.
    • macOS / Linux: autofs prefix refusal -> component-wise openat(..., O_NOFOLLOW) from / -> fstatfs verifying MNT_LOCAL on macOS and non-network/non-autofs magic on Linux; verify_within_root reuses the verified root OwnedFd directly instead of re-opening by path. macOS bundle detection covers an expanded package suffix list, Info.plist, and the kHasBundle Finder flag.

2. File links, reveal & Open-in (features/files, features/open-in, apps/desktop, features/settings, crates/opencode-plugin-runtime)

  • No OS default-app execution from links: Removed open_default / open_in_default. Outside-workspace chat/terminal links (and Draft links) at most reveal the item in the file manager on a verified local fixed drive (including Linux parent-directory reveal via can_reveal_outside). opencode-code-path: UNC links are rejected ahead of plugin_open_link.
  • Safe file-manager reveal: Windows uses binary PIDL splitting (parent_pidl, 1, &child_pidl, 0) with SHOpenFolderAndSelectItems and paired CoUninitialize (no explorer.exe /select,"..." fallback); macOS uses /usr/bin/open -R --; Linux uses xdg-open on the directory or parent directory.
  • Every disk-touching entry point wired through the shared verifier: Win::{open,reveal}, Mac::{open,reveal}, open_app_as, open_at, drag_item, System:Reveal, toast Reveal, location_card::reveal (removing post-refusal Path::exists() in home/projects.rs and settings/pages/project.rs), opencode_plugin_runtime::reveal, browser-policy::{path_within_root,is_safe_workspace_root}, and local video playback (features/files/src/{ops,video}.rs, with no fail-open fallback to /api/fs/read/... when verify_within_root rejects a local symlink/junction).
  • Windows Terminal & Finder hardening: wt.exe refuses folder names containing ;; CLSID-suffixed folders and macOS symlinks/bundles never reach non--R Explorer or /usr/bin/open.

3. Timeline & Markdown images (crates/session-view/src/images/{drag,menu}.rs, apps/desktop/src/shell/view/session/host.rs)

  • drag::file_name allow-lists only content-sniffed raster extensions (png, jpg, gif, webp, bmp, ico, avif), never falls back to URL/attachment extensions, and checks the first dot-delimited segment against is_windows_device_name (so CON.foo.png becomes image.png). Non-raster bytes (such as SVG served as .hta) are never written to opencode-drag.
  • Removed bare explorer / /usr/bin/open / xdg-open from open_with_system and reveal_with_system; both route through shared safe reveal.

4. Reconciling #297 (apps/desktop/src/surfaces/files/reply.rs, features/files/src/{ops,video}.rs)

  • Play videos inline in chat and add browser and Finder link actions #297 (918d24f9) added (a) a right-click context menu on assistant reply links that ran synchronous std::fs::metadata before opening the menu and wired Open file to crate::open_in::open_default, and (b) an inline reply video player that passed local paths and direct http(s) URLs to rune::Player::new on display.
  • Merging dev (5fed7fcd, then 5d50c6f7) preserves Play videos inline in chat and add browser and Finder link actions #297's web-link menu, verified plain-directory Explorer/Finder actions, inside-workspace Open file, and inline player UI for verified workspace clips while:
    • rejecting raw UNC hrefs in reply::target and replacing std::fs::metadata with browser_policy::verify_local_path before showing the menu;
    • routing inside-workspace Open file to the built-in viewer and offering safe Reveal only (no Open file) for outside-workspace files and bundles;
    • confining video::source on native local servers strictly to browser_policy::verify_within_root (no fail-open /api/fs/read/... fallback);
    • temporarily narrowing Play videos inline in chat and add browser and Finder link actions #297's inline video auto-load for security: reply::video auto-loads only verified regular files inside the session workspace (Link::Inside). Link::Web (http(s)) and Link::Outside render as ordinary links on display to eliminate zero-click SSRF (including loopback/LAN/metadata addresses on remote servers) and outside-workspace video decode on macOS, pending the follow-up PR that restores them behind explicit click-to-load and remote-server address policy.

Driven proof (Windows proved live: baseline 5a1a37ba vs head c7c55276)

Case Before After (c7c55276)
Chat link to outside .bat / .lnk 5a1a37ba: spawned bare explorer.exe <path> 0 executions, 0 explorer.exe spawns; routed to safe reveal
Chat links: 12 UNC / subst / mapped-drive / junction forms (\\, //, file://host, file:///\\, file://localhost/\\, %5C%5C, \??/UNC/, WebDAV @port, subst-to-UNC, mapped SMB, subst-to-junction, outside junction) 5a1a37ba: reached disk / explorer.exe All 12 refused; 0 loopback trap hits, 0 UNC/SMB/junction I/O calls (--launch-trace-io), 0 reveals
Chat link to ordinary outside doc / inside workspace doc 5a1a37ba: outside doc spawned bare explorer.exe Outside doc safely revealed; inside doc opened in built-in Files viewer
Terminal Ctrl+click: .bat, .lnk, UNC/WebDAV, outside doc 5a1a37ba: .bat and .lnk spawned bare explorer.exe 0 executions, 0 explorer.exe spawns, 0 UNC/SMB I/O calls; valid local files safely revealed
Timeline Markdown image right-click Open (BMP at /evil.bat, SVG at /evil.hta, PNG at /CON.foo.png) 5a1a37ba: wrote opencode-drag\...\evil.bat and spawned "explorer" ...\evil.bat BMP wrote sniffed evil.bmp and safely revealed (0 explorer spawns); SVG wrote 0 files / 0 spawns; /CON.foo.png wrote image.png and safely revealed
Windows Terminal ; in folder name (repo; new-tab cmd vs repo-clean) 5a1a37ba: spawned wt.exe -w new -d "...\repo; new-tab cmd" ; folder refused (0 wt.exe spawns); repo-clean still opened normally
Plugin System:Reveal (UNC, subst-to-UNC, mapped SMB, junction, outside .bat) 5a1a37ba: opened UNC/mapped/subst/junction paths and spawned explorer.exe 5 times 0 UNC/SMB/junction I/O calls, 0 explorer.exe spawns; valid local .bat safely revealed
Windows PIDL split (ILCreateFromPathW -> (parent, 1, &child, 0)) on .lnk, .url, .zip, .search-ms, dir.{CLSID}, and plain directory 5a1a37ba: used (full, 0, NULL, 0) with explorer.exe /select fallback All 6 split cleanly to (parent, child) PIDL (childPidlBytes > 0)
Workspace NTFS junction for inside .html and .mp4 links d616d701: .mp4 fell back to 5 /api/fs/read/junc-outside/clip.mp4 requests 0 local opens of junction targets (page.html / clip.mp4) and 0 /api/fs/read/ fallback requests
Windows 11 Cloud Filter (cldflt.sys sync root: docs 0x9000601A, hydrated index.html, dehydrated dehydrated.txt 0x9000401A, hostile junction junc_out 0xA0000003) d616d701: blanket FILE_ATTRIBUTE_REPARSE_POINT check rejected 0x410 Cloud Filter tags under PHCM_EXPOSE_PLACEHOLDERS Outside reveal and Cloud Filter workspace reply menu work (hydrations=0), while junc_out inside the Cloud Filter directory is still refused (0 target opens, 0 reveals)
#297 reply link right-click menu & inline video display 918d24f9: outside Open file called open_default; std::fs::metadata probed network/junction paths; standalone http(s) and outside .mp4 auto-loaded on display Outside .bat omits Open file and offers safe Reveal only; inside .md Open file opens built-in viewer; subst/junction right-clicks make 0 disallowed I/O calls; standalone http(s) and outside .mp4 render as plain links (0 HTTP hits, 0 disk opens on display)
#281 oc-preview:// engine suite (cross-OS /remote/work on Windows, 15 broad roots, T1–T11, Cloud Filter) 1ee0f1f8: is_safe_workspace_root broke cross-OS /remote/work previews Full engine security suite ALL_PASS (15/15 broad roots refused, /remote/work remote preview 200/206 ok, Cloud Filter hydrated+dehydrated ok, junction blocked)
Junction-aliased local workspace root (ws-alias -> workspace, fail-closed) 5d50c6f7: used std::fs::canonicalize on the root Refused fail-closed with no crash or blank: reveal shows toast Couldn't open / Refusing symlink or reparse point, inline video stays a plain link, reply link menu omits local actions, HTML click refuses cleanly

Platform proof scope: Windows proved live; macOS and Linux verified by reading (and cross-platform checks). Local OpenCode server /api/fs/read symlink confinement lives in anomalyco/opencode, outside this repository.

Known limitations

On dev (5d50c6f7), is_safe_workspace_root and path_within_root used std::fs::canonicalize on the workspace root, so a local workspace opened through a symlink or NTFS junction alias (for example ~/work/proj -> ~/repos/proj on macOS or a directory junction on Windows) worked across local file features. In this PR, verify_local_path and verify_within_root fail closed whenever any component of the path — including the workspace root itself — is a symlink or junction (only non-redirecting Windows Cloud Filter / OneDrive, WOF, and Dedup reparse tags are allowed). A user whose workspace is opened through a symlink or junction alias will see:

  • Reveal (outside-workspace link, Files/Review Reveal, Location card Reveal): refused with an error toast (Couldn't open — Refusing symlink or reparse point).
  • Open in (File Explorer/Finder, VS Code, Cursor, Terminal, etc. from toolbar or menus): refused with the same error toast (Couldn't open — Refusing symlink or reparse point).
  • Reply link right-click menu: local link actions (Open file, Reveal in File Explorer/Finder, Open in File Explorer/Finder) are omitted and the right-click falls back to the ordinary message context menu (web links keep their menu).
  • Inline video: standalone workspace video links in chat replies stay ordinary clickable links instead of mounting the inline player (and clicking a video in the Files panel shows a not-found toast rather than streaming locally).
  • HTML previews (legacy file:// preview tabs): browser_file_roots and engine safe_roots reject the aliased root, so opening a workspace .html file via legacy file:// refuses with the browser refusal banner/toast (Only web pages can open here), while Show the file's code in the Files viewer still works.
  • Drag-out (Files/Review tree): dragging files out of the Files/Review tree into other apps is disabled (returns no drag item).

Opening the workspace by its real (non-symlinked) folder path restores all six features immediately. This also applies when an OS-managed symlink or volume mount point sits in the workspace's ancestry — specifically Linux distributions where /home symlinks to /var/home (such as Fedora Silverblue/Atomic: open via /var/home/… instead) and Windows volumes or Dev Drives mounted at a folder rather than a drive letter (macOS /tmp//var//etc, APFS firmlinks, local /Volumes/<disk>, Windows 11 OneDrive Known Folder Move, and drive-letter Dev Drives all work). A follow-up PR will restore aliased local workspace roots safely by resolving the workspace root once at start-up (without touching SMB/autofs) and storing/passing that resolved physical root — never the raw alias — into every later check, with the home/system directory check applied to the resolved physical path case-insensitively on macOS and Windows.

What the official app (anomalyco/opencode, dev 4390284d4d) does

No — the official app never opens or runs a file through the OS default handler on a chat Markdown or terminal link click:

  • Chat Markdown links (packages/session-ui/src/components/markdown.tsx -> packages/app/src/runtime/plugin/render.tsx -> packages/gui-plugins/src/file/renderer.tsx): Non-HTML files (including outside-workspace paths) are read through the OpenCode server API into the built-in read-only file tab viewer, and outside-workspace HTML files are refused with a toast (preview.outside). Neither shell.openPath, shell.showItemInFolder, nor shell.openExternal is called. (checkFileLinkExists in resolve-link.ts also skips // UNC and ~.)
  • Terminal links (packages/gui-plugins/src/terminal/terminal-key-event.ts -> terminal.tsx): terminalLinkTarget blocks plain paths, UNC file://server/share, %2f/%5c in file:, and non-http(s)/mailto: schemes; only relative inside-workspace file:/// links open in the built-in viewer. openExternalURL (packages/desktop/src/main/files/external-url.ts) calls shell.openExternal strictly for http:, https:, and mailto:.
  • OS shell.openPath / shell.showItemInFolder (packages/desktop/src/main/files/index.ts) are only called from explicit toolbar/menu Open in … and Reveal actions (plus browser download reveal and log export).

Left for follow-ups

  • Inline video click-to-load (follow-up PR): Restore outside-workspace local and http(s) inline video behind an explicit user click + local-path verification and remote-server address policy (no loopback, private, link-local, or metadata hosts).
  • Links & nearby surfaces (follow-up PR): Percent-decode query keys in mailto: attachment filter; explicit OS scheme allow-list; OSC 8 confirmation dialog hardening (strip bidi/controls, length cap, punycode host, no userinfo, IDN homoglyph confirmation); zero-click SSRF/disk-probe hardening (web_fetch, Markdown images, code_paths); plugins/file/init.luau backslash .. traversal fix; Links:Exists and services/diag.rs local-path guards; routing office/toast/System:OpenExternal through classify_app_link; dropping .cmd/.bat shim fallback in features/open-in/src/windows.rs; image menu "Reveal" label / SVG Save-As extension / wasm32 SVG blob handling; blocking attacker-authored opencode-code-path: links in Markdown; gating HARNESS_OPEN_EXTERNAL_LOG out of release builds.
  • History & plugin bindings (follow-up PR): Restrict Browser:History* and TakeAppLinkReview to the built-in browser UI on user gesture; confine frecency/history writes and isolate non-default tabs; move and harden browser history import off the UI thread.

… paths before disk access

Confinement fix for the live outside-workspace file link RCE and UNC NTLMv2 leak
(`review-rd-tools.md` Finding 1, present since `e2b712c8` and in published `0.0.0-dev-440` `efc20a22`):

- **Policy (`crates/browser-policy/src/local_path.rs`):**
  - Add pure string-level `is_unc_or_device_path`, `is_raw_unc_href`, `safe_local_reveal_path`,
    and `is_macos_bundle_path` rejecting UNC/SMB shares (`\\server\…`, `//server/…`,
    `file://server/…`), Win32/NT device namespaces (`\\?\…`, `\\.\…`, `\??\…`), drive-relative
    paths, NTFS alternate data streams, reserved device names, quotes, controls, bidi overrides,
    and `..` traversal BEFORE any filesystem call (`exists`, `metadata`, `canonicalize`).
- **Never execute outside-workspace links (`features/files/src/{links,host}.rs`,
  `features/open-in/src/{lib,windows}.rs`, `apps/desktop/src/{workspace/system/open_in,surfaces/files/mod}.rs`):**
  - Remove `open_default` / `open_in_default` completely (`links.rs` was the sole caller).
  - Refuse raw UNC hrefs BEFORE `classify`, `plugin_open_link`, or filesystem touch -> toast naming path.
  - Route non-UNC outside links (and Draft `Link::Inside`) at most to file-manager reveal
    (`open_in_reveal_abs` -> `reveal_local`) on verified local fixed drives only.
  - On Windows (`features/open-in/src/windows.rs::reveal`): verify `GetDriveTypeW == DRIVE_FIXED`
    BEFORE `Path::exists()`, select via binary PIDL `SHOpenFolderAndSelectItems`, and remove the
    command-line `explorer.exe /select,"..."` fallback.
  - On macOS/Linux: validate `safe_local_reveal_path` BEFORE `Path::exists()`; always pass
    `/usr/bin/open -R -- <path>` on macOS and parent directory to `xdg-open` on Linux.
- **Harden other OS-reveal entry points (`apps/desktop/src/plugin_host/bridge/requests.rs`,
  `apps/desktop/src/shell/chrome/status_toast.rs`, `apps/desktop/src/shell/view/location_card.rs`,
  `crates/opencode-plugin-runtime/src/reveal.rs`):**
  - Route `Request::Reveal` (`System:Reveal`) and toast Reveal through `open_in::reveal_abs`.
  - Guard `location_card::reveal` and `opencode_plugin_runtime::reveal` with `safe_local_reveal_path`
    + directory/bundle checks so bare `explorer.exe <path>` / `/usr/bin/open <path>` never executes files.
Hona added a commit that referenced this pull request Nov 20, 2026
…18..UP-122 (#295)

- Fold verified fleet PRs #278, #285, #287, #288, #289, #290, #291, and
  #293 (Rune dc8f7f72: #1301, #1302 focus rescue verified Send+Enter -> effort)
  into docs/upstream-sync/ledger.{json,md}
- Close UP-062 packaged-default regression (#278), UP-095-UI / UP-100 /
  UP-106 / UP-109 / UP-117 (#285, #289), and PRE-08 (#287); reassign
  UP-115, UP-116, UP-075 to BROWSER-UI
- Add separate Reviewed column for browser rows tracking retrospective
  security reviews on merged PRs (#245, #268, #272, #277, #288, #275, #287,
  #285, #289) and pre-merge holds (#274, #280, #281, #283, #286, #292, #294,
  and BROWSER-TOOLS PR 3+)
- Audit upstream anomalyco/opencode bfee96a859..2002222d13 (+6 commits:
  1 skipped, 5 added: UP-118..UP-122) and refine radar routing
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR test build retired — merged into dev. Install or auto-update OpenCode (Rune) from https://anoma.ly/release/opencode/desktop-rune/dev/macos-arm64-dmg.

Hona added 8 commits November 21, 2026 02:12
…ndle launch, and local-path NTLMv2 leaks

Addresses all 6 blockers from the independent security review of #294:
- Timeline/Markdown image drag & Open (`crates/session-view/src/images/{drag,menu}.rs`,
  `apps/desktop/src/shell/view/session/host.rs`): allow-list content-sniffed raster extensions
  only (never keep URL/attachment extension); never write non-raster bytes into opencode-drag;
  remove bare explorer/open/xdg-open from open_with_system/reveal_with_system and route through
  shared safe reveal.
- Windows Terminal & Open-in CLI audit (`features/open-in/src/{windows,lib}.rs`): refuse `;` in
  folder paths for wt.exe; validate all targets via `browser_policy::verify_local_path` before
  launching editors/terminals; select CLSID-suffixed folders safely in parent.
- macOS bundle launch (`features/open-in/src/lib.rs`, `location_card.rs`, `local_path.rs`):
  route Finder opens through `/usr/bin/open -R --` only; never pass symlinks or bundles
  (expanded suffix list + Info.plist + kHasBundle Finder flag) to bare `/usr/bin/open`.
- Shared authoritative OS local-path verifier (`crates/browser-policy/src/local_fs.rs`):
  `QueryDosDeviceW` subst-to-UNC & network-redirector guard + `GetDriveTypeW == DRIVE_FIXED` +
  component-wise `FILE_FLAG_OPEN_REPARSE_POINT` walk + `GetFinalPathNameByHandleW` on Windows;
  autofs prefix block + `openat(O_NOFOLLOW)` + `fstatfs` (`MNT_LOCAL` on macOS, non-network/
  non-autofs magic on Linux); `(parent_pidl, 1, &child_pidl, 0)` `SHOpenFolderAndSelectItems`
  with paired `CoUninitialize`. Wired ahead of every disk touch in `open-in`, `browser-policy`
  (`path_within_root`, `is_safe_workspace_root`), `files/src/ops.rs` (local video),
  `location_card`, `home/projects.rs`, `settings/pages/project.rs`, `opencode-plugin-runtime`,
  and `session-view/src/images/menu.rs`.
- Complete UNC/device string filters (`crates/browser-policy/src/local_path.rs`,
  `features/files/src/code_paths.rs`): catch `file:///\\...`, `file://localhost/\\...`,
  percent-encoded `%5c`/`%2f` UNC forms, mixed `\??/` & `/??\`, control/bidi/BOM prefixes,
  and `opencode-code-path:` links ahead of `plugin_open_link`.
- Unix regressions: scope `:` and DOS device stem rejections to Windows; add `can_reveal_outside`
  so Linux outside-workspace links reveal parent directories cleanly.
… local-path confinement

Merges origin/dev (5fed7fc, including #297 918d24f) into browser-ui/sec-a1-file-links:
- apps/desktop/src/surfaces/files/reply.rs: reject raw UNC hrefs in target(), replace
  std::fs::metadata(&path) with browser_policy::verify_local_path(&path) before building the
  right-click menu, remove OS open_default ("Open file") for outside-workspace files (outside
  files offer safe Reveal only; inside-workspace files open in the built-in viewer), and guard
  local video paths with verify_local_path / verify_within_root.
- features/files/src/{ops,video}.rs: route local video playback through
  browser_policy::verify_within_root before handing a local path to rune::Player.
- apps/desktop/src/shell/view/session/host.rs & crates/session-view/Cargo.toml: preserve both
  sides' TimelineHost methods and dependencies.
…ick web/outside reply video auto-load

- `features/files/src/video.rs`: on native local servers (or with no server), return
  `browser_policy::verify_within_root` directly with no fallback to `/api/fs/read/...`, so a
  workspace symlink or junction cannot bypass confinement via the local server.
- `features/files/src/ops.rs`: when `video::source` rejects a video path, return without falling
  through to `read_file`.
- `apps/desktop/src/surfaces/files/reply.rs`: confine `reply::video` auto-load on display to
  verified regular files inside the session workspace (`Link::Inside`); `Link::Web` (`http(s)`)
  and `Link::Outside` render as plain links until click-to-load and remote-server address policy
  land in a follow-up PR.
…d/WOF/Dedup), reuse Unix root fd, and guard multi-dot DOS device names

- `crates/browser-policy/src/local_path.rs` & `lib.rs`: add shared `is_allowed_local_reparse_tag`
  rejecting all name-surrogate tags (bit 29) and unknown tags while allow-listing only
  non-redirecting local tags (`IO_REPARSE_TAG_CLOUD*`, `IO_REPARSE_TAG_ONEDRIVE`,
  `IO_REPARSE_TAG_WOF`, `IO_REPARSE_TAG_DEDUP`).
- `crates/browser-policy/src/local_fs.rs` & `apps/browser-engine/src/preview/handle_path.rs`: wire
  both Windows handle walkers to `browser_policy::is_allowed_local_reparse_tag` via
  `GetFileInformationByHandleEx(FileAttributeTagInfo)` so Windows 11 OneDrive Known Folder Move
  (`Desktop`/`Documents`/workspaces) and WOF/Dedup files work while symlinks, junctions, mount
  points, and `APPEXECLINK` remain refused.
- `crates/browser-policy/src/local_fs.rs`: reuse the verified `OwnedFd` from `verify_path_open`
  inside Unix `verify_within_root` instead of re-opening `root` by path without `O_NOFOLLOW`.
- `crates/session-view/src/images/drag.rs`: pass the first dot-delimited segment of the sanitized
  stem to `is_windows_device_name` so multi-dot names such as `CON.foo.png` map to `image.png`.
…e previews and resolve symlinked local workspace roots once

- `crates/browser-policy/src/workspace_root.rs` & `lib.rs`: restore `is_safe_workspace_root`
  to a pure lexical check (`normalize_root_lex`, `is_broad_root_lex`, `is_home_broad_lex`)
  so cross-OS remote workspace roots (e.g. remote Linux `/remote/work` evaluated on Windows)
  and engine `oc-preview://` callers are unaffected. Add `is_safe_local_workspace_root` for
  known-local callers (`apps/desktop/src/surfaces/browser/mod.rs`, `path_within_root`).
- `crates/browser-policy/src/local_fs/{mod,windows,unix}.rs`: split `local_fs` by platform
  and add `resolve_local_root`, resolving a local symlink/junction workspace alias once up
  front (`FSCTL_GET_REPARSE_POINT` on Windows, `openat(O_NOFOLLOW)` + `readlinkat` on Unix,
  refusing UNC/mapped/autofs targets before following) so workspaces opened via a symlinked
  alias work while inner workspace symlinks/junctions and aliases to broad/system folders
  stay refused.
- `crates/browser-policy/src/local_path.rs`: document why `IO_REPARSE_TAG_CLOUD*`,
  `IO_REPARSE_TAG_ONEDRIVE`, `IO_REPARSE_TAG_WOF`, and `IO_REPARSE_TAG_DEDUP` are
  non-redirecting and that WIM overlays and NTFS dedup chunk stores require Administrator.
…-up, gate engine safe_roots, and fold macOS home-root case

- Move symlinked/junction-aliased local workspace root resolution (`resolve_local_root`,
  `resolve_root`, `resolve_root_open`, `read_reparse_target`, `resolve_reparse_hop`,
  `readlink_at`, `join_unix_symlink`, and `Win32_System_{IO,Ioctl}`) out to follow-up
  branch `browser-ui/followup-alias-root`: local workspace roots that are themselves a
  symlink or junction fail closed via `verify_local_path` / `verify_within_root`.
- `apps/browser-engine/src/engine.rs`: route `safe_roots` through
  `browser_policy::is_safe_local_workspace_root`.
- `crates/browser-policy/src/workspace_root.rs`: compare home/system suffixes
  case-insensitively on macOS as well as Windows (`cfg!(any(windows, target_os = "macos"))`).
@Hona
Hona merged commit ae3e910 into dev Nov 20, 2026
7 checks passed
@Hona
Hona deleted the browser-ui/sec-a1-file-links branch November 20, 2026 18:47
Hona added a commit that referenced this pull request Nov 20, 2026
…eparse policy and unconditional file:// ban
Hona added a commit that referenced this pull request Nov 20, 2026
- Fold security-confirmed merged PRs #292 (6d7a6ed, WS-1 mandatory
  RemoteServer proxy), #294 (ae3e910, BROWSER-UI file-link/click-to-run
  fix with known symlink/junction root limitation), and #274 (5da6474,
  WS-9 engine MV3 extension host, inert without --extension flags)
- Update browser Reviewed column: #301 in rework (#287 eager-attach
  time_updated regression still live on dev), #296/#298/#302/#303/#305/#306
  in rework, #307 open for pre-merge security review
- Audit upstream anomalyco/opencode fe8def6854..4122af0206 (+2 commits:
  1 skipped #65255 core/codemode, 1 added UP-135 #65215 -> WS-8)
Hona added a commit that referenced this pull request Nov 20, 2026
…310)

- Update UP-095-UI evidence to reflect that the 4 #294 findings remained
  present from 0.0.0-dev-440 through published 0.0.0-dev-449 (b62e698)
- Refresh open browser PR security-review states (#296 4th read, #301 3rd
  read, #303 2nd read, #307 updated after 1st read, #308 1st read)
Hona added a commit that referenced this pull request Nov 20, 2026
Hona added a commit that referenced this pull request Nov 21, 2026
…d OS scheme handoff (PR B) (#315)

* fix(browser-policy,open-in): harden mailto/OS-scheme allow-list, code-path links, open_file, save_download, and macOS volume case checks (A2a)

Splits Security PR A2 by surface (A2a: links, OS schemes, Open-in, plugin/app path guards;
A2b: images, zero-click fetches, remote media auth; A2c: terminal OSC 8 dialog):
- `crates/browser-policy/src/app_links.rs` & `plugins/browser/refusal.luau`: percent-decode query
  keys (and split on `&`/`;`, failing closed on malformed `%`/controls) in `mailto_has_attachment`
  for `attach|attachment|attachments|file|filename|filepath|body-file` (for both conversation and
  page sources); reject BOM/zero-width chars; add explicit `is_safe_os_external_url` allow-list.
- `crates/browser-policy/src/lib.rs`: reject `\` before `/` in `destination_origin` /
  `is_http_with_credentials` (closing `http://public.example.com\@127.0.0.1/`).
- `crates/browser-policy/src/local_fs/unix.rs`: honor macOS per-volume case sensitivity via
  `fpathconf(fd, _PC_CASE_SENSITIVE) == 0` in `verify_within_root` (from #294 Mac run).
- `features/open-in/src/{lib,windows}.rs`, `apps/desktop/src/workspace/system/open_in.rs`,
  `features/office/src/sheet/input.rs`, `status_toast.rs`, `requests.rs`: enforce
  `is_safe_os_external_url` at every OS handoff (`open_external`, spreadsheet links, toast
  `openUrl`, `System:OpenExternal`); drop `.cmd`/`.bat` shim fallback in `windows.rs::resolve`;
  launch Windows Terminal via `wt -w new -d .` with `.current_dir(&dir)`; gate
  `HARNESS_OPEN_EXTERNAL_LOG` behind `debug_assertions`.
- `apps/desktop/src/surfaces/browser/links.rs`: stop cross-session `focused_tab_id` fallback in
  `queue_browser_app_link_review`.
- `crates/session-view/src/style.rs`: ignore attacker-authored `opencode-code-path:` Markdown
  links (and never suppress their hover tooltip) unless verified in `code_links`.
- `plugins/file/init.luau` & `tool_open.rs`: block backslash `..` traversal and UNC/device paths
  in `open_file` MCP tool / `Workspace:Relative`.
- `plugin_host/services/{ui,diag}.rs` & `opencode-kit/src/client/downloads.rs`: guard
  `Links:Exists` and heap-snapshot metadata via `verify_local_path`; confine `save_download`
  strictly to a single safe basename inside Downloads.

* fix(browser,open-in,settings,updater): close A2a review findings (open_file, 23 confirmed app schemes, settings/updater routes, mailto allow-list)

* chore(desktop): gate native-only app-link review items for wasm32 builds

* fix(browser): use wrap_anywhere for app-link review bar target fits() check

* fix(browser): fix zero-tab/mid-load review survival, pointerdown 500 ms guard, live window viewport fits(), 60 s TTL wake, and host document_input

* style(browser): keep touched files within arch-check and file-size ceilings
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.

1 participant