Skip to content

Reject unsafe device read paths - #22

Merged
steipete merged 2 commits into
mainfrom
aknight-device-path-read-blocks
May 23, 2026
Merged

steipete merged 2 commits into
mainfrom
aknight-device-path-read-blocks

Conversation

@amknight

Copy link
Copy Markdown
Member

Summary

  • Add a shared unsafe device-read path guard for POSIX device/fd namespaces and Windows reserved device names.
  • Enforce the guard before opening files in fs-safe read/open primitives, including root reads, local reads, regular-file reads, secure-file reads, and pinned sync opens.
  • Export the guard helpers from the path and advanced surfaces, and document the new device-path FsSafeError code.

Verification

  • pnpm check passed: 36 test files, 387 passed, 2 skipped.

Notes

  • The full check needs permission to create temporary directories under ~/.Trash because of existing trash-helper tests.

@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The PR adds a device-path read guard for POSIX device/fd namespaces and Windows reserved device names, wires it into fs-safe read/open primitives, exports helper APIs, adds tests, and updates docs/changelog.

Reproducibility: yes. by source inspection: current main has no device-path code and opens root/local reads without this guard, while the PR adds focused matcher and pre-open coverage. I did not run tests because this was a read-only review.

PR rating
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Summary: The patch looks focused and reviewable with no blocking finding, but it still needs maintainer sign-off on compatibility and security-boundary policy.

Rank-up moves:

  • Get maintainer approval for the fail-closed device-path upgrade behavior.
  • Add Windows runtime output if maintainers want proof beyond matcher tests.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Not applicable: The PR author is a repository member, so the external-contributor real behavior proof gate does not apply; the body reports pnpm check.

Risk before merge

  • Existing consumers that intentionally read known device or process-fd paths through fs-safe will now receive FsSafeError("device-path") after upgrade.
  • The PR matcher-tests Windows reserved device names, but the body reports pnpm check rather than real Windows runtime read/open output.
  • The new helper API is exported from path and advanced, so maintainers should confirm the public surface is wanted before release.

Maintainer options:

  1. Approve fail-closed device reads (recommended)
    Merge once maintainers confirm these device/fd paths are unsupported read inputs and the new device-path error is acceptable for upgrades.
  2. Ask for Windows runtime proof
    If platform confidence is required, ask for redacted Windows console output or an artifact showing reserved device reads fail before open.
  3. Narrow exported helper scope
    If maintainers do not want a public matcher API yet, keep the internal guard and defer or reduce the path/advanced exports before merge.

Next step before merge
No narrow automated repair is indicated; the next action is maintainer review of the compatibility and security-boundary tradeoff.

Security
Cleared: No supply-chain or security regression was found; the diff is focused on failing closed for unsafe read targets and does not touch dependencies, workflows, secrets, or install scripts.

Review details

Best possible solution:

Land the guard only after maintainers accept the fail-closed compatibility change and exported helper scope, keeping the current denied-path API intact.

Do we have a high-confidence way to reproduce the issue?

Yes by source inspection: current main has no device-path code and opens root/local reads without this guard, while the PR adds focused matcher and pre-open coverage. I did not run tests because this was a read-only review.

Is this the best way to solve the issue?

Yes directionally: a shared pre-open guard is the narrow maintainable place for this safety policy. The remaining question is maintainer acceptance of the fail-closed compatibility change and public helper surface, not a concrete code defect.

Label changes:

  • add rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🌊 off-meta tidepool, patch quality is 🐚 platinum hermit, and The patch looks focused and reviewable with no blocking finding, but it still needs maintainer sign-off on compatibility and security-boundary policy.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR author is a repository member, so the external-contributor real behavior proof gate does not apply; the body reports pnpm check.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is bounded filesystem-safety hardening with tests and docs, but it is not an emergency runtime outage.
  • merge-risk: 🚨 compatibility: The PR intentionally changes read/open behavior for existing callers that target known device or process-fd paths.
  • merge-risk: 🚨 security-boundary: The patch changes the filesystem read boundary and adds a new fail-closed security policy before file opens.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🌊 off-meta tidepool, patch quality is 🐚 platinum hermit, and The patch looks focused and reviewable with no blocking finding, but it still needs maintainer sign-off on compatibility and security-boundary policy.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR author is a repository member, so the external-contributor real behavior proof gate does not apply; the body reports pnpm check.

What I checked:

  • Current main has no device-path error code: Current main's FsSafeErrorCode union includes denied-path but not device-path, so the PR is not already implemented on main. (src/errors.ts:1, 6a0236b95e10)
  • Current main opens reads without this guard: Current main's root read/open path lstat-checks and then calls fs.open without a device/fd path rejection before open. (src/root-impl.ts:187, 6a0236b95e10)
  • PR head adds a dedicated matcher and error: The PR adds src/device-path.ts with POSIX blocked device paths, POSIX fd namespace detection, Windows reserved-device detection, and FsSafeError("device-path"). (src/device-path.ts:1, a4a3726934a2)
  • PR head enforces the guard before read opens: The diff wires the guard into root/local reads, regular-file reads, secure-file reads, and pinned sync opens before the read/open path proceeds. (src/root-impl.ts:179, a4a3726934a2)
  • PR head preserves the current denied-path surface: After the force-push, the diff adds device-path alongside existing denied-path in source and docs rather than dropping the deny-mutation error surface. (src/errors.ts:1, a4a3726934a2)
  • Relevant area history: History points to recent root/read/open and release work by Peter Steinberger, including the reusable fs-safe primitives and later filesystem hardening commits. (src/root-impl.ts:179, 751ca8fddafb)

Likely related people:

  • Peter Steinberger: Current history and blame show most root/read/open, pinned-open, error, docs, and release-surface work in this area flowing through Peter Steinberger. (role: recent area contributor; confidence: high; commits: 5ddca800c6aa, 500243f39830, 751ca8fddafb; files: src/root-impl.ts, src/regular-file.ts, src/secure-file.ts)
  • amknight: The current changelog credits @amknight for the recent denyMutations feature sharing this PR's error/docs surface, and the GitHub context shows this PR author is a repository member. (role: adjacent contributor; confidence: medium; commits: cb91a5e42b30; files: CHANGELOG.md, src/errors.ts, docs/errors.md)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 6a0236b95e10.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 💎 rare Frosted Proofling

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 💎 rare.
Trait: collects tiny proofs.
Image traits: location status garden; accessory little merge flag; palette charcoal, cyan, and signal green; mood celebratory; pose curling around a status light; shell glossy opal shell; lighting subtle sparkle highlights; background small green status lights.
Share on X: post this hatch
Copy: My PR egg hatched a 💎 rare Frosted Proofling in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@amknight
amknight force-pushed the aknight-device-path-read-blocks branch from 87da017 to a4a3726 Compare May 22, 2026 04:55
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 22, 2026
@steipete
steipete merged commit 5bf3014 into main May 23, 2026
12 checks passed
@steipete
steipete deleted the aknight-device-path-read-blocks branch May 23, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants