{"id":"XE-12967","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":2305,"title":"desk: OG card cache has no in-flight dedup — N concurrent cold requests for the same card each run a full PIL render, no rate limit on /og","area":"other","claimed_tier":"minor","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-14T14:51:11.451891+00:00","updated_at":"2026-11-20T19:46:43.780467+00:00","source_created_at":null,"told_at":"2026-11-20T19:45:48.329328+00:00","status_changed_at":"2026-11-20T19:45:43.914296+00:00","url":"https://bounty.xe.network/XE-12967","body":"## Summary\n\n`desk/og.py` `_cached` checks the dict cache and, on miss, calls `make()` (PIL\nrender via `draw_card`) with no in-flight/lock coalescing. Concurrent cold\nrequests for the same etag each render the card. The OG routes carry no rate\nlimit.\n\n## Reproduction (real app + real Postgres, desk @ ab9df7f)\n\nHTTP-level harness `h10c_og_http_stampede.py` (counting wrapper on\n`draw_card`):\n\n- 20 concurrent cold `GET /og/XE-0001.png` → **20 renders**, wall 1.65 s.\n- 20 sequential warm requests → 0 renders.\n- 5 distinct cold cards → 5 renders.\n\nFunction-level harness `h10b_og_mirror.py`: 20 concurrent same-etag calls →\n20 `make()` calls; cache cap holds at 512; `draw_card` 82–194 ms per render.\n\n## Impact\n\nUnauthenticated CPU amplification: one cold card × N concurrent requests = N\nfull PIL renders. Bounded by the 512-entry cache once warm, and by the\nthreadpool; a rotating set of cold etags (distinct titles/tickets) keeps it\ncold. Minor/robustness. No state corruption, no funds at risk.\n\n## Duplicate check (disclosed sibling)\n\nThis is the desk instance of the rule XE-6925 reports for the DAO: TTL caches\nwithout single-flight. XE-6925 (body read in full) covers DAO\n`records._shared` + `EventLog.verify_cached` — node round trips and full\nevent-log replays behind `GET /v1/log/verify`. This report covers different\ncode (`desk/og.py:_cached`), a different service (desk), a different trigger\n(concurrent cold HTTP GETs on `/og` routes), and a different cost (PIL\nrenders ~150 ms CPU each). Precedent for per-surface sibling filings:\nXE-7217 (desk sibling of XE-0196), XE-4803/XE-5438 (same int64 class,\ndifferent routes).\n\n- XE-7195 (body read in full): seal-retirement of social cards — cache\n  invalidation/lifetime, distinct mechanism; no mention of concurrent\n  rendering.\n- Searches: `og cache` (0), `draw_card` (1: XE-7195), `social card` (3, none\n  about rendering concurrency), `og.png` (0), `single-flight` (3, none desk\n  OG), `concurrent render` (0). No ticket covers desk OG render concurrency.\n\n## Suggested fix\n\nCoalesce in-flight renders: keep a per-etag future for the running render and\nhave concurrent missers await the same result (single-flight); apply a rate\nlimit to the `/og` routes.","patch_refs":[],"thread":[{"id":15166,"source":"desk","source_ref":"reply:13057","author":"Joseph Denne","team":true,"body":"Thank you for this report. We have read it against the current tree and it is being handled. The assessment and any award follow the fix.","created_at":"2026-11-20T19:45:48.321144+00:00"}]}