Skip to content

fix(security): sanitize sibling callback names - #382

Merged
steipete merged 5 commits into
mainfrom
codex/filename-fallback-20260914
Sep 16, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/filename-fallback-20260914

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Fallback filenames pass through the same sanitization as primary names, and completed sibling staging components are validated before producer callbacks run. This closes bypasses through fallback and callback names while preserving bounded filenames, extension handling, and Windows device-name rejection.

The integration keeps the current descriptor-handoff and private-producer cleanup lifecycle. Callback parents retain valid Windows namespace-root spelling, and raw/resolved parent aliases are checked before constructing the completed path. Internal callback tests use the new directory/component interface while preserving receiver identity and isolation behavior.

The package builds and 218 focused filename, output, callback, snapshot, namespace, and private-producer tests pass (26 platform skips). Fresh independent review through P2 is clean. Complete platform CI passed on the final PR head.

@steipete
steipete requested a review from a team as a code owner September 15, 2026 04:08
@clawsweeper

clawsweeper Bot commented Sep 15, 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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 16, 2026, 9:43 AM ET / 13:43 UTC (Revision 15).

ClawSweeper review

What this changes

The branch sanitizes fallback filenames, validates staging names before producer callbacks, binds ZIP metadata to decoded entries, and checks cancellation before compressed-input refills.

Merge readiness

⛔ Blocked before merge - 4 items remain

This remains useful security hardening absent from current main and v0.12.0. No new blocking code defect was found; the recorded conditional acceptance remains unsatisfied.

Priority: P2
Reviewed head: 5d4ebba092cd5935f1aa6d33d5ab1e39f87fabd8

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation and focused regression coverage are useful, but required consumer proof and performance acceptance remain outstanding.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The supplied and live-matching body reports tests, but provides no consumer-run public-API output demonstrating the changed sanitizer and ordinary/private staging paths preserving safe callers, confining publication, and rejecting invalid names before producers. Archive regression tests and benchmark fixtures are supplemental evidence. 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 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The supplied and live-matching body reports tests, but provides no consumer-run public-API output demonstrating the changed sanitizer and ordinary/private staging paths preserving safe callers, confining publication, and rejecting invalid names before producers. Archive regression tests and benchmark fixtures are supplemental evidence. 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 10 items Repository policy: Read the complete root AGENTS.md and contribution guidance. No nested AGENTS.md or maintainer-notes directory was present. Applied filesystem-boundary, compatibility, focused-scope, and changelog guidance; did not execute review helpers or artifact-producing checks.
Main still needs fallback hardening: Current main returns fallbackName directly for empty or unusable primary names. The branch instead subjects both candidates to the same sanitizer, then uses the fixed file fallback.
Released behavior: The v0.12.0 source also returns unusable-name fallbacks verbatim; the latest supplied release does not implement this central change.
Findings None None.
Security None None.

How this fits together

fs-safe turns untrusted filenames and archive entries into guarded filesystem operations. These changes strengthen admission before producer callbacks, archive member selection, and publication.

flowchart TD
  A[Untrusted filenames] --> B[Sanitize and validate staging names]
  B --> C[Producer callback]
  C --> D[Guarded publication]
  E[Archive bytes] --> F[Validate names and entry kinds]
  F --> G[Bounded reads or extraction]
  H[Cancellation signal] --> G
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The supplied and live-matching body reports tests, but provides no consumer-run public-API output demonstrating the changed sanitizer and ordinary/private staging paths preserving safe callers, confining publication, and rejecting invalid names before producers. Archive regression tests and benchmark fixtures are supplemental evidence. 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) - Existing callers relying on verbatim unsafe fallbacks will receive changed names, and some previously accepted ZIP metadata now fails closed; safe-caller upgrade compatibility remains unproven in a consumer setup.
  • Resolve merge risk (P1) - Comparative performance acceptance remains unresolved for this head and its included archive prerequisites; historical failed controls also prevent confident attribution of measured slowdowns.
  • Complete next step (P2) - Add consumer proof and comparative performance evidence for the landing revision, and resolve the included archive prerequisites. Terminal output or logs are suitable; redact private paths, endpoints, credentials, and other private details. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth Production +166 net lines; tests +813 net lines Production growth implements three stated hardening changes; test counts include the added Rust regression coverage.
Stacked scope 37 files; 2 open prerequisite PRs The landing delta includes archive changes beyond the filename-focused title.

Merge-risk options

Maintainer options:

  1. Complete the recorded landing conditions (recommended)
    Provide consumer compatibility evidence and a passing comparative study for the landing revision, resolving the included archive prerequisites first.
  2. Hold the stack
    Keep this branch paused while the ZIP and cancellation performance conditions remain unresolved.

Technical review

Best possible solution:

Retain the shared sanitization and pre-producer admission boundary, with demonstrated safe-caller upgrade compatibility and accepted performance evidence, then land the filename change after its archive prerequisites.

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

Yes, from source: current main returns an unsafe fallback verbatim when the primary filename is empty or unusable. No runtime reproduction was executed.

Is this the best way to solve the issue?

Yes for the filename repair: applying one sanitizer to both candidates and validating completed components preserves the existing guarded publication design. The broader stack still needs its recorded compatibility and performance validation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is bounded filesystem hardening with no supplied evidence of an active emergency.
  • merge-risk: 🚨 compatibility: Fallback outputs and accepted ZIP interpretations change for existing callers, with consumer compatibility proof still outstanding.
  • merge-risk: 🚨 other: Added filename and archive admission work has unresolved comparative performance conditions beyond ordinary CI.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The supplied and live-matching body reports tests, but provides no consumer-run public-API output demonstrating the changed sanitizer and ordinary/private staging paths preserving safe callers, confining publication, and rejecting invalid names before producers. Archive regression tests and benchmark fixtures are supplemental evidence. 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: Read the complete root AGENTS.md and contribution guidance. No nested AGENTS.md or maintainer-notes directory was present. Applied filesystem-boundary, compatibility, focused-scope, and changelog guidance; did not execute review helpers or artifact-producing checks. (AGENTS.md:1, 5d4ebba092cd)
  • Main still needs fallback hardening: Current main returns fallbackName directly for empty or unusable primary names. The branch instead subjects both candidates to the same sanitizer, then uses the fixed file fallback. (src/filename.ts:95, 2374204cc8d0)
  • Released behavior: The v0.12.0 source also returns unusable-name fallbacks verbatim; the latest supplied release does not implement this central change. (src/filename.ts:95, 914cd7b41388)
  • Admission before producers: Completed names reject separators, controls, stream colons, terminal dot/space aliases, and reserved devices before callbacks. Private publication retains workspace identity checks and descriptor handoff; ordinary publication retains post-open identity checks. (src/sibling-staged-file.ts:38, 5d4ebba092cd)
  • Conditional compatibility acceptance: The discussion explicitly accepts hardened fallback semantics conditional on public-API consumer proof and comparative performance evidence: fix(security): sanitize sibling callback names #382 (comment). The live body matched the supplied snapshot and still provided test claims without the requested consumer transcript. (5d4ebba092cd)
  • ZIP compatibility boundary: Portable decoding now rejects metadata interpretations it cannot faithfully represent, including UNIX-only directory attributes and backslash-only directory names. Documentation and regression tests explicitly describe these new rejections. (docs/archive.md:151, 5d4ebba092cd)

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.

  • Provide redacted consumer output for safe fallback compatibility, ordinary/private publication, and rejection before producer execution.
  • Provide comparative performance results tied to the candidate and baseline revisions under the recorded gates.
  • Resolve the included ZIP and cancellation prerequisites and refresh the final landing delta.

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 (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-15T15:15:12.130Z sha 6ead119 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-15T17:46:14.517Z sha 01d44ed :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-15T19:55:15.417Z sha 30044be :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-15T20:19:30.013Z sha 9a10102 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-15T20:53:42.476Z sha 405d6a8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-15T22:34:09.129Z sha 309c86f :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T12:54:17.907Z sha 0b0a552 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T13:30:09.047Z sha 29344f9 :: needs real behavior proof before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer decision: accept the hardened exported fallback contract, conditional on the promised consumer proof and performance evidence. A fallback that is already a safe bounded filename remains its existing fixed point. Empty, reserved, separator-bearing, colon-bearing, trailing-dot/space, control-bearing, or overlong fallbacks may now be sanitized, truncated, or replaced with the documented fixed ile default instead of being returned verbatim. That compatibility change is intentional: fallback text is attacker-controlled at the same boundary as the primary name and must not bypass the shared filename policy. Callers that require an exact display label should store it separately from the filesystem component. Landing remains held until exact-head public-API evidence covers safe-caller compatibility, confined ordinary and private publication, and rejection before producers, and until the comparative performance gates pass.

Bind ZIP physical entry names and kinds to decoder metadata before callbacks or member selection, rejecting ambiguous interpretations consistently.
@steipete
steipete force-pushed the codex/filename-fallback-20260914 branch from 309c86f to 0b0a552 Compare September 16, 2026 12:49
@steipete
steipete force-pushed the codex/filename-fallback-20260914 branch from 0b0a552 to 29344f9 Compare September 16, 2026 13:25
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Sep 16, 2026
Stop zstd and bzip2 compressed-input refills after cancellation while retaining decoded-output and complete archive validation.
Sanitize fallback filenames and validate completed sibling callback components before producers run, retaining bounded names and Windows device-name rejection.
@steipete
steipete force-pushed the codex/filename-fallback-20260914 branch from 29344f9 to 5d4ebba Compare September 16, 2026 13:38
@steipete
steipete merged commit 5d4ebba into main Sep 16, 2026
33 checks passed
@vincentkoc
vincentkoc deleted the codex/filename-fallback-20260914 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: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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.

1 participant