Skip to content

fix(hosts): make identity persistence durable and check the CA file - #92

Merged
wstein merged 2 commits into
mainfrom
fix/86-identity-durability
Oct 16, 2026
Merged

wstein merged 2 commits into
mainfrom
fix/86-identity-durability

Conversation

@wstein

@wstein wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Implements #86: durable identity persistence and a safe server CA file.

  • e4d94ec: fsync the identity directory's parent after Mkdir, including on retry; remove the exclusive-link temp name before the directory fsync.
  • ef314ad: CA path must be absolute and clean; the CA file is opened with O_NOFOLLOW|O_NONBLOCK, checked on the open descriptor (regular file, size, not group/other-writable, owned by root or the agent user) and read from that descriptor.

Known limitation: ownership of the directories above the CA file is not checked (outside #86).

Review: CLEAR (Opus 5.5) on ef314ad after four rounds. make check on this head is pending. Stacked on the pilot PR (H51:b).

🤖 Generated with Claude Code

@wstein
wstein force-pushed the fix/86-identity-durability branch from ef314ad to c1a30d9 Compare October 16, 2026 10:35
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Review CLEAR on ef314ad (Opus 5.5). Restacked onto pilot 75526bb (CI boundary fix); git range-diff shows every commit identical, so the review carries over. make check on this head: pending.

@wstein
wstein force-pushed the pilot/installable-pilot-pr branch from 75526bb to 7656115 Compare October 16, 2026 10:42
@wstein
wstein force-pushed the fix/86-identity-durability branch from c1a30d9 to dd6be58 Compare October 16, 2026 10:42
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main 54a002f after #95 merged; git range-diff shows every patch identical (for #83 only one context line in docs/index.md differs), so the review carries to dd6be58. make check on this head: pending.

@wstein
wstein marked this pull request as ready for review October 16, 2026 10:55
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Ready per owner: review CLEAR on this head; local make check replaced by one final check on main after the stack merges (owner rule).

@wstein
wstein force-pushed the pilot/installable-pilot-pr branch from 7656115 to 866e46c Compare October 16, 2026 11:19
@wstein
wstein force-pushed the fix/86-identity-durability branch from dd6be58 to 8038ad3 Compare October 16, 2026 11:19
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Restacked onto pilot 866e46c; git range-diff identical, review carries to this head.

@wstein
wstein force-pushed the pilot/installable-pilot-pr branch from 866e46c to 2235c20 Compare October 16, 2026 11:31
Base automatically changed from pilot/installable-pilot-pr to main October 16, 2026 11:31
@wstein
wstein force-pushed the fix/86-identity-durability branch from 8038ad3 to cb0ecb6 Compare October 16, 2026 11:32
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Restacked onto main e82167b after #96/#91 merged; range-diff identical, review carries to cb0ecb6.

wstein and others added 2 commits October 16, 2026 13:37
Fsync the parent directory on every Prepare, including when the identity
directory already exists, so a retry after a failed sync never reports
success for an entry that may not be durable. Remove the .identity-* temp
name before the directory fsync on the exclusive link path so one sync
makes link and removal durable and a crash cannot leave a second copy of
the private key.

Refs: #86

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Require the server CA path to be absolute and clean in Prepare and
validate. Open the CA with O_NOFOLLOW, Fstat the descriptor and apply the
regular-file, size, mode (no group/other write) and owner (root or the
agent's effective user) checks to it, then read from the same descriptor
with a 32 KiB limit, closing the stat-then-open race.

Known limitation: ancestor-directory ownership of the CA path is not
checked; out of scope for #86.

Refs: #86

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@wstein
wstein force-pushed the fix/86-identity-durability branch from cb0ecb6 to cd36caa Compare October 16, 2026 11:37
@wstein
wstein merged commit f265b22 into main Oct 16, 2026
2 checks passed
@wstein
wstein deleted the fix/86-identity-durability branch October 16, 2026 11:38
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