acme/store: create key temp file with O_EXCL + target mode (no world-… · KarpelesLab/httpsd@381e4ca · GitHub
Skip to content

Commit 381e4ca

Browse files
MagicalTuxclaude
andcommitted
acme/store: create key temp file with O_EXCL + target mode (no world-readable race)
Fixes [HIGH] finding: atomic_write created the temp file world-readable (mode ~0644 by umask) and only chmod'd it to 0600 afterward, leaving a race window where private keys were readable, and used a fixed non-O_EXCL temp name (symlink-clobber hazard). Now create the temp with create_new(true) (O_EXCL) + .mode(mode) on Unix, force exact bits via set_mode, use a per-call unique name (pid + atomic counter) in the target directory, and remove the temp on error. Preserves sync_all + rename and the 0644/0600 split for chain/key files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent adcff6f commit 381e4ca

1 file changed

Lines changed: 86 additions & 5 deletions

File tree

‎src/acme/store.rs‎

Lines changed: 86 additions & 5 deletions

0 commit comments

Comments
 (0)