{"id":"XE-0993","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":242,"title":"GET /team/triage.md and triage.pending_duplicates_of bypass read:private checks, and ticket.html/my.html expose unannounced award_xe","area":"other","claimed_tier":"medium","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":null,"status":"triaging","closed_reason":null,"github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-07T04:06:16.392074+00:00","updated_at":"2026-11-08T20:46:48.410510+00:00","source_created_at":null,"told_at":"2026-11-08T20:46:48.416538+00:00","status_changed_at":"2026-11-08T20:46:36.872571+00:00","url":"https://bounty.xe.network/XE-0993","body":"Three closely related authorization and disclosure gaps exist in the triage and ticket rendering paths added/updated in commits `56735d7` and `d4198e7`:\n\n### 1. `GET /team/triage.md` allows `read:public` agent tokens and leaks private ticket metadata (`desk/api/mirror.py:165-171`, `desk/services/triage.py:199-243`)\n\nWhile the HTML route `GET /team/triage` (`desk/ui.py:490`) enforces `_team(who)` (human team session only), its Markdown mirror `GET /team/triage.md` (`desk/api/mirror.py:165-171`) only checks `can(who.principal, \"read:notes\")`:\n\n```python\n@router.get(\"/team/triage.md\", response_class=PlainTextResponse)\nasync def team_triage_md(ctx: Ctx, db: Db, who: Who, area: str | None = None, ...):\n    if not can(who.principal, \"read:notes\"):\n        raise HTTPException(403, \"team and triage agents only\")\n```\n\nUnder `desk/authz.py:66-70`, any agent token with `\"read:public\"` scope satisfies `can(p, \"read:notes\")` when `ticket=None`. `team_triage_md` then calls `triage.build_queue(ctx, db, ...)` (`desk/services/triage.py:199-243`), which queries `Ticket` rows directly without filtering on `Ticket.visibility == \"public\"` when `not can(p, \"read:private\")` and formats reporter labels/emails via `rsvc.label(reporters[t.reporter_id])` plus pending proposal summaries. Thus an agent token scoped only to `read:public` (explicitly denied `read:private`) can fetch `/team/triage.md` and read every private ticket's ID, title, area, status, reporter email/handle, and pending proposal details.\n\nSimilarly, `triage.pending_duplicates_of(db, tid)` (`desk/services/triage.py:246-267`, called from `desk/ui.py:201` on `/tickets/{tid}`) queries `Proposal` joined to `Ticket` without filtering `Ticket.visibility` by the caller's principal, so a `read:public` token viewing a public canonical ticket sees the IDs and titles of `private` tickets that have pending duplicate proposals pointing to it.\n\n### 2. `ticket.html` and `my.html` render `t.award_xe` and approval state before status is `awarded`/`paid` (`desk/templates/ticket.html:52`, `desk/templates/my.html:27`)\n\nIn `desk/services/tickets.py:299-301`, the JSON API hides `award_xe` from non-team readers until `t.status in (\"awarded\", \"paid\")`:\n\n```python\n\"award_xe\": (t.award_xe // 1_000_000 if t.award_xe is not None else None)\nif (see_held or t.status in (\"awarded\", \"paid\"))\nelse None,\n```\n\nHowever, the Jinja templates `desk/templates/ticket.html:52-58` and `desk/templates/my.html:27` bind directly to the ORM model `t.award_xe` and `t.award_approved_at`:\n\n```html\n{% if t.award_xe is not none %}\n<dt>Award</dt>\n<dd class=\"num\">{{ (t.award_xe // 1000000) }} XE\n  {% if t.award_approved_at %}<span class=\"muted\">(approved)</span>{% else %}<span class=\"muted\">(awaiting Reviewer approval)</span>{% endif %}\n</dd>\n{% endif %}\n```\n\nAs soon as an award amount is staged or proposed on a ticket still in `triaging`, `accepted`, `fixing`, or `patched`, anonymous visitors on `/tickets/{id}` and reporters on `/my` see the held `award_xe` amount and whether a Reviewer has approved it.\n\n### Remediation\n\n1. In `desk/api/mirror.py:167`, require `can(who.principal, \"read:private\")` (or pass `who.principal` into `triage.build_queue` and `triage.pending_duplicates_of` and filter out `Ticket.visibility == \"private\"` when `not can(p, \"read:private\")`).\n2. Gate the `t.award_xe` block in `ticket.html` and `my.html` on `is_team or t.status in ('awarded', 'paid')`.","patch_refs":[],"thread":[{"id":1235,"source":"desk","source_ref":"reply:776","author":"Joseph Denne","team":true,"body":"Thanks for the report. We checked the desk source: the triage-export route and helper names in the first part are not in the code, and the export is already restricted to the team and its agents. The second part — the award field being visible on a ticket before it is awarded — is being looked at. We will update this ticket when there is more to say.","created_at":"2026-11-08T20:46:48.410510+00:00"}]}