fix: validate IDs in GetNextCheckpointSequence before directory read

main

Commit

Soph3mo ago

The PostToolUse (TodoWrite) hook passed input.SessionID and the task tool-use ID straight into SessionMetadataDirFromSessionID / TaskMetadataDir and then os.ReadDir, with no validation — unlike every other hook entry point. A crafted "../.." could redirect the directory listing. Validate both IDs at this choke point; an invalid value simply starts the checkpoint sequence at 1.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: ddf2fe4a50fe

Checkpoints

Review Security Vulnerability Report

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1