{"id":"XE-17986","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":2260,"title":"Sealing attachments into the blob store is a non-transactional filesystem mutation: a rollback leaves sealed ciphertext served publicly and the ticket unsealed","area":"other","claimed_tier":"medium","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-18T03:17:50.334950+00:00","updated_at":"2026-11-23T09:05:28.640645+00:00","source_created_at":null,"told_at":"2026-11-23T09:05:28.653153+00:00","status_changed_at":"2026-11-23T09:05:28.645143+00:00","url":"https://bounty.xe.network/XE-17986","body":"Area: desk/services/tickets.py (seal_thread / set_facts)\n\nSummary\nWhen a ticket's visibility is switched to private, `set_facts` calls `seal_thread` while the request transaction is still uncommitted. `seal_thread` rewrites every attachment blob on disk (`path.write_bytes(vault.seal(...))`) and seals message/reply bodies in place. If anything fails after the first blob write but before the commit, the filesystem now holds ciphertext while the database rolls back to unsealed rows and a public ticket. The rows still say sealed=False, the ticket stays public, and `open_attachment` serves the on-disk (now sealed) blob to public readers: public attachment downloads permanently return opaque ciphertext, while a partially-completed loop can leave some blobs sealed and others plaintext for the same ticket. There is no recovery path — re-sealing skips rows whose DB flag is false but whose bytes are already ciphertext, and nothing marks them for re-write.\n\nEvidence\n- desk/services/tickets.py:1203 `async def seal_thread(...)`\n- desk/services/tickets.py:1218-1224 `path.write_bytes(ctx.vault.seal(path.read_bytes()))` executed inside the still-open transaction; `a.sealed = True` set on the ORM row only\n- desk/services/tickets.py:958-967 `set_facts` visibility->private branch calls `seal_thread(ctx, db, t)` before commit\n- desk/services/reporters.py:592-596 `open_attachment` streams whatever bytes are on disk with no seal-awareness\n- Failure sources between first write and commit: `ctx.events.append` can raise (log signing failure), the `ticket.sealed` insert can fail, connection drop, or process death mid-loop (partial seal)\n\nAttack path / impact\nNot attacker-driven directly; a transient error or crash during a visibility change corrupts sealed evidence permanently. A ticket that should be private remains public with its attachments now unreadable garbage; a partially sealed ticket leaks the unsealed remainder while the sealed part is destroyed. Sealed evidence integrity is a core promise of the desk (bug triage records).\n\nPreconditions\nA visibility change to private on a ticket with attachments; any error/crash between the first blob write and commit.\n\nFix\nMake the mutation transactional end-to-end: seal into new blob paths (write ciphertext to a temp location), commit DB rows, then swap/rewrite blobs after commit with a recovery sweeper that reconciles disk state to committed rows; or journal the seal operation so a crashed run can be resumed idempotently.","patch_refs":[],"thread":[{"id":19733,"source":"desk","source_ref":"reply:17399","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-17986 and says what differs; it is read like any other.","created_at":"2026-11-23T09:05:28.640645+00:00"}]}