Skip to content

fix(security): harden cross-platform containment - #65

Merged
steipete merged 2 commits into
mainfrom
fix/pre-release-security-containment
Jul 27, 2026
Merged

fix(security): harden cross-platform containment#65
steipete merged 2 commits into
mainfrom
fix/pre-release-security-containment

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • resolve symlink aliases component-by-component before applying later parent traversal, and validate raw root() inputs before normalized I/O
  • prefer macOS 15.4+ O_RESOLVE_BENEATH, retain the component-walk fallback, and apply an F_GETPATH containment detector to both routes
  • return { fd, containment } from native openBeneath() and expose containment on JavaScript open/read/writable results
  • document Linux kernel-atomic containment versus macOS, Windows, and JavaScript best-effort behavior without claiming macOS rename-race atomicity

Item 1 verification

The claimed v0.4.7 root() escape did not reproduce against tag v0.4.7 or current main: read/open rejected, and write/openWritable operated on the normalized in-root path without touching the outside inode. That containment behavior dates to the initial root implementation in 5ddca80.

The exported resolveRootPath validator did still normalize before walking aliases, so it could approve a different spelling than a direct caller later used. This change fixes that live validation flaw and adds the exact sub/up/../outside/secret.txt regression for read, write, open, and openWritable through both forced-JavaScript and native-enabled configurations.

Proof

  • pnpm check
  • pnpm test:security
  • pnpm pack:check
  • pnpm docs:site
  • pnpm native:build
  • pnpm native:test
  • rustfmt --edition 2024 --check native/src/lib.rs native/src/unix.rs
  • packed-artifact source-blind behavior validation: 6/6 clauses passed
  • autoreview: clean, no accepted/actionable findings

@steipete
steipete requested a review from a team as a code owner July 27, 2026 08:23
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(security): harden cross-platform containment This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 3749731 into main Jul 27, 2026
21 checks passed
@steipete
steipete deleted the fix/pre-release-security-containment branch July 27, 2026 08:32
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