Skip to content

fix(attachments): authorize runtime agent reads - #830

Merged
lilyshen0722 merged 1 commit into
mainfrom
fix/agent-runtime-attachment-read
Aug 4, 2026
Merged

fix(attachments): authorize runtime agent reads#830
lilyshen0722 merged 1 commit into
mainfrom
fix/agent-runtime-attachment-read

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Summary

  • resolve opaque cm_agent_* runtime tokens on raw attachment and PPTX-preview reads
  • evaluate the resolved bot user through the existing canReadAttachment policy; signed URL and human JWT paths are unchanged
  • correct the preview route comment to reflect its existing shared authorization

Verification

  • npm test -- --runInBand __tests__/unit/routes/uploads.test.js (8/8)
  • PATH=/opt/homebrew/opt/node@22/bin:$PATH npm test -- --runInBand __tests__/service/uploads.signedurl.integration.test.js (7/7)
  • npm test -- --runInBand __tests__/unit/routes/uploads.signedurl.test.js (10/10)
  • npm run tsc:check

The service test uses a real runtime token, a bot User, and pod membership; a deliberate object-store miss returns 404, proving the request passed authorization rather than stopping at 403.

Mutation proof

Removing the agent canReadAttachment handoff makes the targeted unit suite fail 3/8: allowed raw read becomes 403, denied-path ACL assertion no longer runs, and the private PPTX preview becomes 403 instead of reaching storage.

@lilyshen0722
lilyshen0722 merged commit 7692a76 into main Aug 4, 2026
11 checks passed
@lilyshen0722
lilyshen0722 deleted the fix/agent-runtime-attachment-read branch August 4, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant