Bounty
XE-1128 · Bounty

desk/services/sync.py: Post-Merge PR Title/Body Edits by Untrusted Contributors Force Unfixed Tickets to patched, Bypassing ASSESSMENT_HELD to Leak Held Assessments

Triaging claimed High web filed 2026-11-07 16:31 UTC by Ashev Ardiansyah

Report

In desk/desk/services/sync.py, link_pull() (lines 178-216) and _follow_pull_state() (lines 224-251) allow any merged GitHub Pull Request whose title or body matches gh.closing_refs() (Fixes #N, Closes #N, Resolves #N) to transition the referenced Desk ticket all the way to status = "patched", regardless of trusted = pull_is_maintainers(ctx, pull), based on line 232:

if state == "merged":
    target, reason = "patched", f"{ref} merged"  # a merge is a maintainer's act whoever wrote the PR

However, on GitHub, any external contributor (author_association == "CONTRIBUTOR", trusted == False) whose PR has ever been merged into a tracked repository retains permanent permission to edit the title and body of their own PR after it has been merged.

  1. Post-merge PR edit triggers unauthenticated state transition to patched (desk/desk/services/sync.py:184-215, 231-244, 287-291, 450-452): When an untrusted contributor edits the title or body of an already-merged PR (e.g., an old docs/typo PR) to append Fixes #1 Fixes #2 ..., GitHub sends a pull_request (action: "edited") webhook to handle_webhook() (sync.py:450-452), which calls link_pull() without checking action or whether the closing reference existed at merge time; import_repo() (sync.py:287-291) also re-processes the PR on the next poll because pull["updated_at"] advances. Because pull["merged_at"] is non-null, state == "merged", and _follow_pull_state() ignores trusted=False and calls tsvc.set_status_via_path(ctx, db, SYSTEM, t, "patched", ...), walking every referenced ticket in PRE_PATCH = ("new", "triaging", "needs-info", "accepted", "fixing") to "patched".

  2. Complete bypass of ASSESSMENT_HELD confidentiality embargo and permanent draft lock (desk/desk/services/tickets.py:230-238, 661-664, 931-941): While a confirmed bounty report is in ASSESSMENT_HELD = ("new", "triaging", "needs-info", "accepted", "fixing"), tickets.to_dict() withholds assessed_tier, verdict, internal_ref, and internal_url from public callers until patched. Forcing unfixed tickets in accepted or fixing to patched immediately sets assessment_held(t) == False, exposing the confidential assessed_tier, verdict, internal_ref, and internal_url of every unpatched vulnerability in that repository on GET /v1/tickets and GET /v1/tickets/{ticket_id}. Simultaneously, stepping new/triaging/needs-info tickets through accepted permanently sets t.body_editable = False (tickets.py:663), locking reporters out of editing their own drafts.

Remediation

If not trusted and state == "merged", do not allow newly added closing references discovered after merged_at (such as on pull_request edited events) to transition tickets to "patched"; only honor closing PatchRef links that were present at merge time or verified via GitHub's closing-issues event metadata.

Thread

Joseph Denneteam2026-11-08 20:08 UTCdesk

Thanks for the report. We have read it and can follow the behaviour you describe in the desk's GitHub sync; it is being handled and we will update this ticket when there is more to say.