Skip to content

fix: close 2026-09 audit findings (B01-B06) and follow-ups - #74

Merged
simota merged 2 commits into
mainfrom
fix/audit-2026-09-06
Sep 6, 2026
Merged

fix: close 2026-09 audit findings (B01-B06) and follow-ups#74
simota merged 2 commits into
mainfrom
fix/audit-2026-09-06

Conversation

@simota

@simota simota commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Close the six 2026-09 audit findings (B01-B06): config-file include write-through/watching, ipc token hard_link publishing, is_tracked, session cap, open-handle reaping
  • Follow-ups from review of that commit:
    • config watcher re-derives the include list on every detected change, so includes added/removed by an edit whose reload fails are still tracked
    • config writer no longer appends repeatable keys (font-family, palette, keybind, …) after an include, avoiding stale accumulated entries on consecutive saves
    • ipc token staging retries on AlreadyExists (stale temp file from a reused PID) and unifies the unix/non-unix publish path

Test plan

  • cargo test -p noa-config -p noa-app (1211 + 212 pass)
  • cargo test -p noa-ipc outside sandbox (loopback bind required) — all pass incl. new token_staging_collision
  • cargo clippy --workspace — no new warnings (pre-existing 4 in noa-pty/noa-app untouched)

https://claude.ai/code/session_01GBe292wmocEXM8SjBzjGq7

…on, and links

- config writer: a key shadowed by a trailing `config-file` include is also
  appended at the end so the saved value is what the reader resolves (B01)
- config watcher: track `config-file` includes (transitive, optional-absent
  included) via new `noa_config::config_include_paths` (B02)
- ipc token: publish via tmp + hard_link (create-if-absent); concurrent
  first-run provisioners converge on one token (B03)
- grid modes: `ModeState::is_tracked` allowlist; unknown modes are no longer
  retained in the linear-scanned set (B04)
- session: 16 MiB file cap and 128-level JSON depth cap so a corrupt file
  fails as "no session" instead of overflowing the stack at launch (B05)
- link_open: reap the `open` child for URIs on a detached thread (B06)

Claude-Session: https://claude.ai/code/session_01GBe292wmocEXM8SjBzjGq7
…nd token staging

- config_reload: re-derive include watch list on every detected change so
  includes added/removed by an edit whose reload fails are still tracked
- writer: skip the post-include append for repeatable keys (font-family,
  palette, keybind, ...) so consecutive saves do not accumulate stale entries
- ipc auth: retry the staging temp file on AlreadyExists (stale file from a
  reused PID) and unify the unix/non-unix publish path

Claude-Session: https://claude.ai/code/session_01GBe292wmocEXM8SjBzjGq7
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T11:17:46.903749Z c2aa079 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.

@simota
simota merged commit d125ba2 into main Sep 6, 2026
1 check passed
@simota
simota deleted the fix/audit-2026-09-06 branch September 6, 2026 11:17

@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: c2aa079f8f

ℹ️ 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".

let existing = fs::read_to_string(path).ok()?;
let trimmed = existing.trim();
if trimmed.is_empty() {
let _ = fs::remove_file(path);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid unlinking a concurrently published token

When two processes encounter the same pre-existing empty or whitespace-only token file, both can finish read_to_string before either removes it; after the first process removes the empty file and successfully publishes token A, the second process can execute this unconditional remove_file, unlink token A, and then publish token B. Both calls consequently return success with different tokens, so if the first process wins the server bind it authenticates with token A while clients read token B from disk. Removing/replacing the empty file must use an atomic operation that cannot delete a nonempty file published since it was inspected.

Useful? React with 👍 / 👎.

@simota simota mentioned this pull request Sep 6, 2026
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