Skip to content

Partition GraphQL response caching by endpoint and token - #8888

Merged
lizkenyon merged 2 commits into
mainfrom
security-graphql-cache-principal
Oct 14, 2026
Merged

lizkenyon merged 2 commits into
mainfrom
security-graphql-cache-principal

Conversation

@lizkenyon

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

GraphQL response cache entries are currently scoped by query and variables, but not by the authenticated request context. Identical requests made with a different endpoint or token should not reuse the same persisted response.

WHAT is this pull request doing?

Add a SHA-256 digest of the endpoint URL and token to each GraphQL response cache key. Raw tokens are never persisted, and the existing cacheExtraKey remains an additive partition.

Existing cache entries will miss once after upgrading and then refill normally.

How to manually test your changes?

CI

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Oct 14, 2026
@lizkenyon
lizkenyon marked this pull request as ready for review October 14, 2026 16:07
@lizkenyon
lizkenyon requested a review from a team as a code owner October 14, 2026 16:07
Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation matches the stated requirements and includes focused regression coverage.

0 open findings

What changed in this PR

Partitions GraphQL caches by endpoint and token digest to prevent authenticated contexts from sharing responses.

Changes:

  • Adds SHA-256 principal partitioning to cache keys.
  • Tests endpoint/token isolation and token concealment.
  • Adds a patch changeset.
File Description
graphql.ts Adds principal digest to cache keys.
graphql.test.ts Tests cache partitioning behavior.
graphql-cache-principal-key.md Documents the user-facing fix.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lizkenyon
lizkenyon added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 25274f3 Oct 14, 2026
28 of 30 checks passed
@lizkenyon
lizkenyon deleted the security-graphql-cache-principal branch October 14, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/cli @shopify/cli package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants