Skip to content

fix(files): handle-based output publication with verification - #358

Merged
SpecterAoD merged 4 commits into
mainfrom
fix/338-handle-output
Nov 28, 2026
Merged

SpecterAoD merged 4 commits into
mainfrom
fix/338-handle-output

Conversation

@SpecterAoD

Copy link
Copy Markdown
Owner

DE: #338 – Ausgaben über Handles statt Namen (Linux/Unix). Ein zugehöriges Security Advisory wird nach dem Merge zusammen mit beta.5 veröffentlicht.

  • Neues Modul src/fs_identity.rs: Identität (Gerät/Inode) des offenen Objekts, linkat auf den Deskriptor (/proc/self/fd/N), renameat2(RENAME_NOREPLACE) mit Rückfall, Prüfung nach dem Veröffentlichen.
  • src/files/output_guard.rs: Temporärdatei behält ein zweites Handle; Temporärordner wird ohne Symlink-Folgen geöffnet (Eigentümer, 0700 geprüft) und unter Linux über /proc/self/fd/N beschrieben; Aufräumen nur des eigenen Objekts.
  • fsutil::publish* veröffentlicht über das Handle und prüft danach; auch Schlüssel- (envelope/io.rs, inkl. Überschreiben) und Faktordateien.
  • Race-Tests aus test(files): deterministic file I/O race tests and threat model #357 für Ordnerziel und Rückfallweg jetzt scharf; neue Tests für ausgetauschten Temporärordner bzw. ausgetauschte Temporärdatei. source_swapped_for_symlink_is_never_read bleibt bis PR 4 ignoriert.
  • rustix-Feature fs (gleiches Crate, keine neue Abhängigkeit), kein unsafe.
  • Lokal: volle Suite grün (117 Gruppen inkl. Doc-Tests), Clippy, Limits, Matrix 1.9.0; unter der CLI-Sandbox per strace geprüft: linkat(…AT_SYMLINK_FOLLOW) und renameat2(…RENAME_NOREPLACE) gelingen, keine Sandbox-Änderung nötig.
  • Windows: Verhalten unverändert (Prüfung dort ohne Wirkung), eigener Schritt folgt; Doku/CHANGELOG nennen die Grenze.

EN: #338 – outputs via handles instead of names (Linux/Unix). A related security advisory is published with beta.5 after merging. Identity (device/inode) of the open object, linkat on the descriptor, renameat2(RENAME_NOREPLACE) with fallback and verification after publishing; temporary directories opened without following symlinks (owner/0700 checked) and written via /proc/self/fd/N; cleanup only of our own object; also key and factor files. Race tests enforced, new swap tests. rustix feature fs, no unsafe. Locally: full suite green, clippy, limits; checked under the CLI sandbox with strace. Windows unchanged, separate step follows.

Refs #338

🤖 Generated with Claude Code

SpecterAoD and others added 2 commits November 28, 2026 02:28
…tput

DE: GHSA-9vh5-2vch-2r68 (Linux/Unix): Temporärausgabe über Handles statt Namen – Dateien per linkat auf den offenen Deskriptor veröffentlicht, Ordner ohne Symlink-Folgen geöffnet (Eigentümer, 0700) und über /proc/self/fd beschrieben, Veröffentlichen ohne Ersetzen (renameat2 NOREPLACE) und Prüfung von Gerät/Inode danach; Aufräumen nur des eigenen Objekts. Auch Schlüssel- und Faktordateien. Windows folgt separat.
EN: GHSA-9vh5-2vch-2r68 (Linux/Unix): temporary output via handles instead of names – files published via linkat on the open descriptor, directories opened without following symlinks (owner, 0700) and written via /proc/self/fd, publication without replacing (renameat2 NOREPLACE) and device/inode verification afterwards; cleanup only of our own object. Also key and factor files. Windows follows separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DE: GHSA-9vh5-2vch-2r68: Race-Tests für Rückfall und Ordnerziel scharf, neue Tests für ausgetauschten Temporärordner (kein Schreiben außerhalb) und ausgetauschte Temporärdatei (nie fremder Inhalt). FILE_IO_RACES, FILE_FORMAT, CHANGELOG, Angriffsmatrix 1.9.0 (QA1-FS-008: Linux behoben, Windows und Quellen offen).
EN: GHSA-9vh5-2vch-2r68: race tests for the fallback and directory target enforced, new tests for a swapped temporary directory (no writes outside) and a swapped temporary file (never foreign content). FILE_IO_RACES, FILE_FORMAT, CHANGELOG, attack matrix 1.9.0 (QA1-FS-008: fixed on Linux, Windows and sources open).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T06:13:15.227106Z 341208f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 341208f802

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/fsutil.rs Resolved
SpecterAoD and others added 2 commits November 28, 2026 07:34
DE: Codex-Fund #358: Schlägt die Prüfung nach dem Verlinken fehl, wird unter dem Zielnamen nichts entfernt (Eintrag nicht nachweislich unserer). Windows-Clippy: Platzhalter ohne /proc mit unnecessary_wraps erlaubt, Unix-Hilfe gekennzeichnet.
EN: Codex finding #358: if verification fails after linking, nothing under the target name is removed (entry not provably ours). Windows clippy: placeholders without /proc allow unnecessary_wraps, unix helper marked.

Refs #338

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DE: Windows-Clippy: handle_path wird nur unter Linux gebraucht; Platzhalter entfernt, PathBuf nur unter Linux.
EN: Windows clippy: handle_path is only needed on Linux; placeholder removed, PathBuf on Linux only.

Refs #338

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SpecterAoD
SpecterAoD merged commit 22c685e into main Nov 28, 2026
23 checks passed
@SpecterAoD
SpecterAoD deleted the fix/338-handle-output branch November 28, 2026 08:17
@github-project-automation github-project-automation Bot moved this from Backlog to Done in PQKeep Roadmap Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant