Bounty
XE-0993 · Bounty

GET /team/triage.md and triage.pending_duplicates_of bypass read:private checks, and ticket.html/my.html expose unannounced award_xe

Triaging claimed Medium web filed 2026-11-07 04:06 UTC by Ashev Ardiansyah

Report

Three closely related authorization and disclosure gaps exist in the triage and ticket rendering paths added/updated in commits 56735d7 and d4198e7:

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)

While 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"):

@router.get("/team/triage.md", response_class=PlainTextResponse)
async def team_triage_md(ctx: Ctx, db: Db, who: Who, area: str | None = None, ...):
    if not can(who.principal, "read:notes"):
        raise HTTPException(403, "team and triage agents only")

Under 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.

Similarly, 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.

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)

In desk/services/tickets.py:299-301, the JSON API hides award_xe from non-team readers until t.status in ("awarded", "paid"):

"award_xe": (t.award_xe // 1_000_000 if t.award_xe is not None else None)
if (see_held or t.status in ("awarded", "paid"))
else None,

However, 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:

{% if t.award_xe is not none %}
<dt>Award</dt>
<dd class="num">{{ (t.award_xe // 1000000) }} XE
  {% if t.award_approved_at %}<span class="muted">(approved)</span>{% else %}<span class="muted">(awaiting Reviewer approval)</span>{% endif %}
</dd>
{% endif %}

As 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.

Remediation

  1. 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")).
  2. Gate the t.award_xe block in ticket.html and my.html on is_team or t.status in ('awarded', 'paid').

Thread

Joseph Denneteam2026-11-08 20:46 UTCdesk

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.