Skip to content

feat(permissions): support private creation through existing verbs - #487

Merged
steipete merged 5 commits into
mainfrom
codex/fs-safe-private-creation-20260918
Sep 18, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/fs-safe-private-creation-20260918

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Consumers need private files and directories without copying platform-specific permissions, descriptor ownership, and cleanup logic into their applications.

User Impact

private: true extends existing Root creation operations (mkdir, ensureRoot, create, and createJson). POSIX defaults are 0700 for directories and 0600 for files. Windows creation applies a protected current-user/System/Administrators DACL. Existing requested directories are validated and never silently repaired.

The advanced entry point adds exclusive, nonrecursive createDirectory, createDirectorySync, and createFileSync. The file operation returns an owned descriptor with idempotent disposal. Existing createPrivateDirectory behavior stays compatible.

macOS private creation requires native descriptor ACL inspection and rejects inheritable ACLs that could override mode permissions. Parent ACLs that do not inherit remain usable. Native off and unavailable inspection reject before creation. Private directory modes 000/0200, including equivalent umask restrictions, are unsupported because their ACLs cannot be inspected without widening permissions; private file mode 000 remains supported.

Windows private-file creation requires same-volume hardlinks. Native off and missing-capability auto use the packaged Windows security command bridge; require rejects missing capabilities before creating parents or staging files.

Why This Change Was Made

Keep privacy as a creation option and reuse existing platform owners. Async creation awaits system commands and filesystem work; retained descriptors bind permission changes and publication to the created object. Recovery details distinguish an inner temporary file from the requested destination.

Real platform tests found two permission pitfalls. Elevated Windows tokens can assign Administrators ownership to a new file despite its private inherited DACL; the implementation normalizes current-user ownership through the verified handle and retains strict final validation. On macOS, inherited ACLs can permit reads despite mode 000; parent and object ACL checks prevent that exposure before writing content.

Closes #482

Evidence

  • Final pnpm check passed 13,744 tests with 591 platform skips, plus build, docs, package/import, boundary, and guest protocol checks. Head 03eeb954 has 31 successful checks and no failures: CI, coverage, and public mutation proof.

  • Fresh installed npm/pnpm tests on macOS cover private/atomic/read-only creation with required flushing, inherited-ACL rejection, and missing-inspector refusal. Missing-addon off/auto installs still exercise ordinary creation.

  • A fresh AWS Linux machine passed native/WASM builds, 71 focused tests, and installed npm/pnpm creation scenarios with normal and omitted optional dependencies. Later platform-specific repairs receive final-head CI proof.

  • A fresh AWS Windows machine reproduced elevated-owner rejection, verified corrected ownership and a protected DACL with the original descriptor still writable, and passed 13 command-backend creation tests. Final native Windows CI and installed npm/pnpm package proof passed on Node 22.23.2 and 24.20.0. Downloaded artifacts match the tested commit and clean source tree; native-required and omitted-addon off/auto creation pass, while omitted-required calls refuse mutation.

  • Real benchmark coverage now includes the three new methods and descriptor disposal; native and fallback sweeps passed. Native buffer equality retains exact byte checks and removes coverage-instrumentation timeouts without increasing timeouts.

  • Independent reviews found no remaining actionable P0–P2 issues.

  • Tests added or updated when behavior changed

  • Security and compatibility impact considered

  • CHANGELOG.md updated when release-relevant

  • No credentials, private paths, private hosts, or sensitive contents included

@steipete
steipete requested a review from a team as a code owner September 18, 2026 21:09
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 18, 2026, 6:48 PM ET / 22:48 UTC (Revision 4).

ClawSweeper review

What this changes

Adds private permissions to existing Root creation operations and exclusive advanced creation APIs with owned file descriptors, platform ACL checks, and explicit publication outcomes.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open: the private-creation capability remains absent from main, and the branch contains useful, coherent work. No concrete blocking code defect was found, but the previous Windows authority-proof gap remains unresolved.

Priority: P2
Reviewed head: 03eeb954df6a0fbbca7d6478109e012345ebd808

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful implementation and extensive focused coverage, with readiness limited by the remaining authority-boundary evidence.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: reported installed-package runs support successful private creation and final ACLs, but the Windows creation/handoff paths still lack public-API observations of unrelated-account denial through publication and revocation preventing publication after preparation. The inspected probe explicitly limits permission observations to after return; blocked log retrieval is a separate reviewer limitation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: reported installed-package runs support successful private creation and final ACLs, but the Windows creation/handoff paths still lack public-API observations of unrelated-account denial through publication and revocation preventing publication after preparation. The inspected probe explicitly limits permission observations to after return; blocked log retrieval is a separate reviewer limitation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 9 items Repository policy applied: Read the complete root AGENTS.md, CONTRIBUTING.md, and SECURITY.md. No nested AGENTS.md or maintainer-notes directory was found. Reviewed confinement, permission handling, compatibility, and settlement conservatively; did not run repository helpers or artifact-producing checks.
Meaningful work remains beyond main: The pinned main RootCreateOptions exposes atomic creation and file flushing but no private option; RootMkdirOptions also lacks privacy. The existing private-directory helper is Windows-only and does not provide the new owned synchronous file descriptor contract.
Related implementation and release boundary: GitHub confirms #486 merged as 50a23bf; it supplies atomic creation and flushing, not this private-creation contract. The latest release endpoint reports v0.15.0. The remaining request is tracked by #482 and this open implementation candidate.
Findings None None.
Security None None.

How this fits together

fs-safe guards filesystem operations requested by Node.js applications. These creation paths turn caller paths, permission options, and mutation-authority checks into new files or directories while preserving existing entries.

flowchart TD
  A[Caller path and creation options] --> B[Root or advanced creation API]
  B --> C[Validate parent and mutation authority]
  C --> D[Select platform permission checks]
  D --> E[Create private directory or pinned file]
  E --> F[Verify identity and publish exclusively]
  F --> G[Return owned descriptor or completion]
  F --> H[Report publication and cleanup failure]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: reported installed-package runs support successful private creation and final ACLs, but the Windows creation/handoff paths still lack public-API observations of unrelated-account denial through publication and revocation preventing publication after preparation. The inspected probe explicitly limits permission observations to after return; blocked log retrieval is a separate reviewer limitation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Windows final ACL checks do not demonstrate that an unrelated account cannot obtain access during creation and publication, or that revocation after preparation prevents final publication through both backends.
  • Resolve merge risk (P1) - Raw linked execution logs were inaccessible through the review network, limiting independent inspection of the reported platform runs.
  • Complete next step (P2) - Add Windows public-API proof for unrelated-account denial through publication and revocation stopping publication after preparation in native and command modes. Terminal output, diagnostic screenshots, or logs are appropriate; redact credentials, private paths, addresses, and endpoints. Update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
JavaScript-facing implementation and test growth src/: +1,500 net lines; test/: +2,181 net lines The production growth supports the stated cross-platform creation and descriptor-ownership contract; these counts exclude Rust, scripts, benchmarks, and documentation.

Merge-risk options

Maintainer options:

  1. Complete the Windows authority evidence (recommended)
    Provide source-bound public-API observations of authorized access, unrelated-account denial through publication, and revocation stopping publication for native and command backends.

Technical review

Best possible solution:

Keep privacy opt-in on shared creation owners, preserve existing defaults and entries, and establish Windows access-denial and revoked-authority guarantees through the public APIs before landing.

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

Not applicable: this adds creation guarantees and API options rather than reporting broken existing behavior; no concrete introduced failure was established.

Is this the best way to solve the issue?

Yes, extending existing verbs and guarded owners fits the linked request and avoids a competing private-only API family; the remaining concern is authority evidence.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cf8299f85a44.

Labels

Label justifications:

  • P2: This is a substantive opt-in filesystem capability without evidence of an active user emergency.
  • merge-risk: 🚨 security-boundary: The new Windows creation and publication paths establish persistent access permissions whose creation-time denial and revoked-authority behavior remain incompletely demonstrated.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: reported installed-package runs support successful private creation and final ACLs, but the Windows creation/handoff paths still lack public-API observations of unrelated-account denial through publication and revocation preventing publication after preparation. The inspected probe explicitly limits permission observations to after return; blocked log retrieval is a separate reviewer limitation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Repository policy applied: Read the complete root AGENTS.md, CONTRIBUTING.md, and SECURITY.md. No nested AGENTS.md or maintainer-notes directory was found. Reviewed confinement, permission handling, compatibility, and settlement conservatively; did not run repository helpers or artifact-producing checks. (AGENTS.md:25, 03eeb954df6a)
  • Meaningful work remains beyond main: The pinned main RootCreateOptions exposes atomic creation and file flushing but no private option; RootMkdirOptions also lacks privacy. The existing private-directory helper is Windows-only and does not provide the new owned synchronous file descriptor contract. (src/root-options.ts:66, cf8299f85a44)
  • Related implementation and release boundary: GitHub confirms feat(root): support atomic creation and required file flushing #486 merged as 50a23bf; it supplies atomic creation and flushing, not this private-creation contract. The latest release endpoint reports v0.15.0. The remaining request is tracked by Extend normal creation with private permissions and atomic publication #482 and this open implementation candidate. (50a23bf99547)
  • Authority checked at publication: The new created-file handoff verifies the retained descriptor, then invokes the synchronous authority callback and repeats parent/file identity checks immediately before the hardlink publication. The synchronous owner follows the same ordering. (src/private-producer-handoff.ts:311, 03eeb954df6a)
  • Windows protection preserves object identity: The native and packaged command backends reject broadly accessible inherited files, compare full Windows identities, and normalize ownership and protected DACLs through verified security handles while the creation descriptor remains retained. (native/src/windows_security.rs:1156, 03eeb954df6a)
  • Darwin admission and payload safeguards: Private creation requires the native ACL inspector, rejects relevant parent inheritance, and checks the created descriptor before payload writes. Focused tests cover unavailable inspectors, restrictive modes, inherited ACLs, and callback-time ACL changes. (src/creation-darwin.ts:26, 03eeb954df6a)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted, source-bound Windows native and command-backend public-API evidence showing authorized access, unrelated-account denial through publication, and revocation preventing publication after preparation.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-18T21:12:20.280Z sha 4e87525 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-18T22:26:34.811Z sha 93421f8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-18T22:42:30.124Z sha 93421f8 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the codex/fs-safe-private-creation-20260918 branch from 4e87525 to 93421f8 Compare September 18, 2026 22:20
@steipete
steipete force-pushed the codex/fs-safe-private-creation-20260918 branch from 93421f8 to 03eeb95 Compare September 18, 2026 22:43
@steipete
steipete merged commit edb9227 into main Sep 18, 2026
36 checks passed
@vincentkoc
vincentkoc deleted the codex/fs-safe-private-creation-20260918 branch September 25, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend normal creation with private permissions and atomic publication

1 participant