Skip to content
quarry View Ticket
Login

View Ticket

Private tickets: honour is_private rather than indexing and ignoring it

Fixed8518c09b21af97c7f2d8cd6a0ce5e0fc452a5bc7Created 104.1 days agoUpdated 67.9 days ago
Description2026-08-18 21:07:50
Fossil can mark a whole ticket private. Two repositories in the corpus carry the `is_private` field. quarry folds it like any other field and gives it no meaning — so a ticket its own tracker marked private is listed, searched, and rendered by quarry to anonymous readers.

This is the same class of defect as the `private_contact` leak fixed in 3918395e, and larger: that one exposed a field, this one exposes an entire ticket.

## Verify first

Before building anything, confirm what is actually in the served corpus:

SELECT count(*) FROM ticket_field WHERE name = is_private AND value NOT IN (0, "")

If the count is non-zero on a public store, this is a live leak and should be treated as urgent rather than as a feature. If it is zero everywhere, it is a correctness gap to close before someone mirrors a tracker that uses it.

## Shape

1. Fold `is_private` into a column on the `ticket` table, not just a row in `ticket_field`, so it can be filtered in the same index walk as status. 2. `ticket.list`, `ticket.get` and the FTS documents all exclude private tickets unless the caller may see them. Search matters as much as the list: a snippet leaks the content whether or not the ticket page is reachable. 3. Reuse the capability from the field-level ticket rather than inventing a second mechanism. 4. A private ticket a caller may not see must report NOT FOUND, never forbidden — the same rule `repoFor` already applies to private repositories, and for the same reason: a 403 confirms the ticket exists.

## Depends on

The capability work, for the "unless entitled" half. The exclusion half depends on nothing and should land first: hiding them from everyone is correct today, exactly as with private_contact.

2026-08-19 12:35:44

Fixed across two passes; this one closes it.

Already held (from the migration work): the list, the board, search (dropped from the corpus, not filtered at query time), and the detail page — TicketByPrefix answers not-found for a private ticket, so a reader cannot even confirm it exists.

Fixed now:

  • Timeline events. Every ticket change wrote an event row — id, author, date on public display. The fold now applies the same rule as the search doc: going private deletes the ticket's event rows, going public RESTORES them from ticket_change. An open-time sweep scrubs indexes folded before events followed privacy (verified live: tcl's 33 private tickets, 0 leaked events, timeline clean).
  • The nav count now reads ticket WHERE private = 0 — a count that disagrees with the list it sits above is a confirmation leak.
  • The one-way door. ticket.set resolved ids through the same filtered reader, so a private ticket was permanently uneditable — nobody could ever un-private one. Writes (token-gated) now resolve via TicketByPrefixAll; reads keep the refusal. Erring toward private is only safe if un-privating stays possible.
  • TicketPrivate(id) errs toward withholding: an unknown id answers private.

Known remainders, deliberately out of scope: attachment blobs remain hash-addressable if the hash is known from elsewhere (nothing public links them any more); contributor counts include private-ticket authors (names only). Both belong to #9561ac07b1's capability design.