Security: fix burn-after-read race (atomic conditional delete) #58

Closed
opened 2026-09-09 13:57:25 +00:00 by poslop · 0 comments
Owner

Split from #34 (MED).

Concurrent reads of a burn_after_read paste can all succeed before SoftDelete lands. Verified in #34: 4/6 concurrent API readers received content. Check-then-delete in registerRead is not atomic.

Fix: atomic conditional UPDATE (deleted_at WHERE id=? AND deleted_at IS NULL) checked via RowsAffected before returning content, or a reads_used conditional guard for burn-after-N.

Split from #34 (MED). Concurrent reads of a burn_after_read paste can all succeed before SoftDelete lands. Verified in #34: 4/6 concurrent API readers received content. Check-then-delete in registerRead is not atomic. Fix: atomic conditional UPDATE (deleted_at WHERE id=? AND deleted_at IS NULL) checked via RowsAffected before returning content, or a reads_used conditional guard for burn-after-N.
poslop added the In Progress label 2026-09-09 14:19:16 +00:00
Sign in to join this conversation.