Repository navigation
fix: stop managed artifact reads after session access is revoked - #174137
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. What this changesBind managed attachment downloads to the issuing reader’s current authority and stop delivery when that authority is revoked. Example: A reader obtains a managed image URL before its shared conversation becomes draft.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current access-revocation defect with no actionable findings; the added runtime evidence resolves the previous authority-proof blocker. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway artifact RPC authorizes a transcript attachment and issues a download grant; the managed HTTP adapter consumes that grant, verifies current reader and session authority, and returns image, thumbnail, playback, or document bytes. flowchart TD
Reader --> ArtifactRPC
ArtifactRPC --> SessionAuthority
ArtifactRPC --> DownloadGrant
DownloadGrant --> ManagedHTTP
SessionAuthority --> ManagedHTTP
ManagedHTTP --> ByteStream
ByteStream --> Reader
Technical reviewBest possible solution: Merge the shared grant-owner repair with retained reader authority and revocation checks throughout managed delivery. Do we have a high-confidence way to reproduce the issue? Current-main ticket verification lacks issuing-reader authority, matching the linked report’s isolated shared-to-draft RPC/HTTP reproduction; this read-only review ran no target code. Is this the best way to solve the issue? The repair addresses the missing authority at the existing grant owner, removes the parallel signing implementation, and preserves established media adapters and ordinary disconnect behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9db9baeb763d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +99, Tests +318, Docs +5. Total +422 across 19 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 16, 2026, 8:13 AM ET / 12:13 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: Managed attachment URLs stop serving media after the issuing reader loses access while ordinary disconnects preserve authorized reads. |
…nclaw#174137) Keep managed attachment downloads bound to the issuing reader’s current session access, including thumbnail and active stream reads, while preserving authorized downloads across ordinary disconnects. Fixes openclaw#174136.
Closes #174136.
What Problem This Solves
A reader could keep using a generated attachment's download URL after losing access to its conversation. Making a shared conversation draft stopped new artifact requests, but an already issued managed-media URL still served the original bytes until its five-minute ticket expired.
User Impact
Existing managed image, thumbnail, audio, video, and document URLs now require the issuing reader's current session access. URLs retain their five-minute lifetime, existing media routes, and continued use after an ordinary WebSocket disconnect. Current device, role, source, and session-access revocation stop reads. Admitted streams retain their source until completion and stop if the reader's authority is revoked.
Thumbnail sizing, media playback conversion, byte ranges, and the authenticated owner route for older clients are preserved. No configuration or data migration is required.
Why This Change Was Made
Managed downloads used a signed ticket that identified the attachment and expiry but did not retain the requesting reader. Both the stable artifact-ID path and legacy transcript-URL path now use the existing bounded artifact-download grant owner. Source preparation only identifies the transcript-backed media; the artifact RPC transfers its retained requester authority and current session-read facts into the grant. Each issuing connection retains at most 128 grants. Disconnected entries keep the five-minute expiry and are reclaimed by the existing maintenance sweep or Gateway teardown; this is a per-connection and time bound, not a global grant limit. Retained requester authority stays in the existing revocation index after its RPC returns, so profile-role changes still reach a disconnected issuer. Ordinary artifact-byte grants retain their existing connection lifetime.
The managed HTTP adapter keeps its established media behavior while checking the grant before disclosure and during streaming. It also rejects using the grant for another attachment or through the generic artifact-byte route. The separate stateless signing implementation is removed, and managed grant responses use private, no-store caching.
Evidence
The isolated RPC/HTTP regression reproduced the defect on the introduction base and again on target commit 7160e1a: correct original and thumbnail media were readable, then the retained original URL still returned HTTP 200 after committed shared-to-draft visibility. The attachment stayed in the transcript.
The fix passes that boundary for both issuing paths, including ordinary disconnect and committed visibility/profile-role revocation. Existing media Gateway E2E passes its full/thumbnail/range/expiry/archive/shared-owner controls (3 cases, 37.89 seconds). The focused media/lifecycle batch passed 383 cases in 23 files (540.10 seconds including required build preparation); affected source-authority consumers and compiler graphs also pass. Hosted CI passed on the published head.
An additional isolated runtime scenario uses a temporary variant of the existing HTTP fixture on production commit 4814d56. The production dispatcher issues the grants, and the client receives real HTTP body bytes before the fixture calls
invalidateGatewayDeviceRevocationorinvalidateGatewayPolicyClientwithrevokeSource: true. Both transfers abort with the correct partial bytes; subsequent full and thumbnail requests through both issuers return 404. Ordinary disconnect remains allowed. The complete scenario, response settlement, and grant-index cleanup passed in 47.95 seconds without a production-code change.Redacted terminal output:
{"proof":"managed-final-effect","authority":"device","stage":"authorized-and-disconnected","variants":4,"status":200,"originalBytes":12588868} {"proof":"managed-final-effect","authority":"device","stage":"revoked-during-transfer","status":200,"firstBytesBeforeRevocation":true,"expectedBytes":12588868,"receivedBytes":131072,"aborted":true} {"proof":"managed-final-effect","authority":"device","stage":"subsequent-full-and-thumbnail","variants":4,"status":404} {"proof":"managed-final-effect","authority":"source","stage":"authorized-and-disconnected","variants":4,"status":200,"originalBytes":12588868} {"proof":"managed-final-effect","authority":"source","stage":"revoked-during-transfer","status":200,"firstBytesBeforeRevocation":true,"expectedBytes":12588868,"receivedBytes":131072,"aborted":true} {"proof":"managed-final-effect","authority":"source","stage":"subsequent-full-and-thumbnail","variants":4,"status":404}Independent source review completed without findings. ClawSweeper is being refreshed with the additional final-effect evidence.