Skip to content

Scope temporary resources to the creating account#205

Merged
zmofei merged 2 commits into
mainfrom
temp-resource-account-binding
Jun 10, 2026
Merged

Scope temporary resources to the creating account#205
zmofei merged 2 commits into
mainfrom
temp-resource-account-binding

Conversation

@zmofei

@zmofei zmofei commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

Temporary resources (mapbox://temp/...) created from large tool responses are now scoped to the account that created them, enforced on read.

Changes

  • TemporaryResource records the creating account (Mapbox username); temporaryResourceManager.create() accepts an owner.
  • The directions, isochrone, and static_map_image tools pass the caller's account when storing a temporary resource.
  • TemporaryDataResource.read resolves the requester the same way tools resolve their token (request auth, then the env token for stdio/single-user) and only returns the resource to the same account; otherwise it returns the standard not-found response — identical to a missing/expired resource.
  • Adds test/resources/temporary/TemporaryDataResource.test.ts (same-account read, cross-account denial, no-existence-oracle, env-token fallback, image blobs).

Testing

  • npm test — full suite green (incl. the new file)
  • npm run build, npm run lint
  • End-to-end: a real directions_tool call creating a temp resource is readable by the creating account and returns not-found to a different account.

@zmofei zmofei force-pushed the temp-resource-account-binding branch 3 times, most recently from 5cd503f to 79e2e49 Compare June 10, 2026 15:32
@zmofei zmofei force-pushed the temp-resource-account-binding branch from 79e2e49 to 5aeab6f Compare June 10, 2026 15:42
@zmofei zmofei marked this pull request as ready for review June 10, 2026 15:43
@zmofei zmofei requested a review from a team as a code owner June 10, 2026 15:43
@zmofei zmofei merged commit fc1056d into main Jun 10, 2026
5 checks passed
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.

2 participants