Skip to content

fix: use cryptographic randomness and restrictive permissions for temp files#40

Closed
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/secure-temp-file-handling
Closed

fix: use cryptographic randomness and restrictive permissions for temp files#40
0x-SquidSol wants to merge 1 commit intonullxnothing:mainfrom
0x-SquidSol:fix/secure-temp-file-handling

Conversation

@0x-SquidSol
Copy link
Copy Markdown

Summary

  • Temp files in ClaudeProvider and CodexProvider used Date.now() for filenames (predictable, enumerable) and default permissions (world-readable on Unix)
  • These files contain sensitive agent context, system prompts, and project metadata
  • Replaced Date.now() with crypto.randomUUID() for unpredictable filenames across all 5 creation points
  • Added mode: 0o600 (owner read/write only) to all 4 writeFileSync calls

Test plan

  • Spawn a Claude agent — verify temp context file is created and cleaned up
  • Spawn a Codex agent — verify temp files are created and cleaned up
  • Verify temp files are not world-readable on Unix
  • Run pnpm run typecheck — passes clean
  • Run pnpm run test — all wallet tests pass (19/19)

…p files

Temp files in ClaudeProvider and CodexProvider used Date.now() for
filenames (predictable) and default permissions (world-readable). Replaced
with crypto.randomUUID() for unpredictable names and mode 0o600 for
owner-only access, preventing local information disclosure of sensitive
agent context and system prompts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nullxnothing
Copy link
Copy Markdown
Owner

Closed as superseded by #75, which reapplies the corrected security hardening on top of current main. This avoids merging stale/conflicted branches and preserves the fixes with passing CI/CodeQL.

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.

2 participants