{"id":"XE-13152","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":2416,"title":"DAO refer_to_resolution is validated against an unlocked row: a decide can commit a referral to a resolution withdrawn mid-flight","area":"dao-harness","claimed_tier":"minor","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-14T17:55:53.129071+00:00","updated_at":"2026-11-15T10:27:05.245120+00:00","source_created_at":null,"told_at":"2026-11-15T10:27:33.526483+00:00","status_changed_at":"2026-11-15T10:27:33.514807+00:00","url":"https://bounty.xe.network/XE-13152","body":"Summary. portal.decide runs under the proposal's row lock, but the resolution it names is read with a plain SELECT and never locked or re-read. A concurrent withdraw by the resolution's proposer can commit in between, and the decide then commits anyway: the proposal ends decided with a recorded referral to a withdrawn resolution, contradicting the function's own stated rule.\r\n\r\nDocumented rule. dao/services/portal.py:370 _decision_resolution docstring: \"A referral names one that is open or passed, an adoption or follow-up one that has passed.\" Withdrawal is the proposer's right while a resolution is open (dao/services/resolutions.py:227), and refer_to_resolution is exactly the decision that may name an open resolution - the only decision type exposed to this race (adopt/decline require passed, and a passed resolution cannot be withdrawn).\r\n\r\nCode path. dao/services/portal.py:413 decide() -> :370 _decision_resolution() for referrals - plain select via resolutions.get(db, res_id) with no lock=True (contrast resolutions.py:248, where the same getter takes with_for_update() when asked, and portal.py:126, where proposals are loaded with_for_update()). dao/api/members.py:53 withdraw_resolution locks and mutates the resolution in its own transaction; nothing orders it against an in-flight decide. Affected code is at dao HEAD 2efbfee.\r\n\r\nReproduction (executed). Two real DB sessions, real route handlers; the decide is paused immediately after _decision_resolution has read the resolution as open, the withdraw commits, then the decide resumes. Output: \"T2 withdraw committed first: resolution status now 'withdrawn'\"; \"T1 decide then committed: proposal status='decided'\" with the referral naming that resolution. Final state: resolution='withdrawn', proposal='decided' with a refer_to_resolution decision.\r\n\r\nImpact. The published, signed decision record refers the matter to a resolution that no longer exists as a live instrument; the referral can never be acted on, and readers of the log see a decision whose premise was already false when it committed. Recovery exists - decide still permits one subsequent adopt/decline after an interim step - so this is record integrity, not a funds or safety issue.\r\n\r\nNovelty. The HEAD sweep's row locks cover the proposal, resolution-signing, and session paths; no TAKEN entry covers the decide path reading a different row (the named resolution) unlocked. Not a re-report of XE-4591 or the session row-lock fix.","patch_refs":[],"thread":[{"id":5377,"source":"desk","source_ref":"reply:4054","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-13152 and says what differs; it is read like any other.","created_at":"2026-11-15T10:27:05.245120+00:00"}]}