Skip to content

Reject invalid store execute variables - #8321

Open
dmerand wants to merge 3 commits into
mainfrom
donald/store-execute-variable-validation
Open

Reject invalid store execute variables#8321
dmerand wants to merge 3 commits into
mainfrom
donald/store-execute-variable-validation

Conversation

@dmerand

@dmerand dmerand commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

--variables and --variable-file accepted non-object JSON values, which reached GraphQL despite the variables object contract.

WHAT is this pull request doing?

Validate variable JSON locally and raise AbortError for null, arrays, primitives, and explicit empty inline input. Preserve malformed JSON and missing-file errors, including their contextual output. Add focused inline and file-backed regression coverage.

How to test your changes?

shadowenv exec -- pnpm exec vitest run packages/store/src/cli/services/store/execute/request.test.ts
shadowenv exec -- pnpm exec nx run store:type-check

Post-release steps

None.

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) and added a changeset.

Assisted-By: devx/02b9a955-e9da-4fba-97d1-f625c956a647
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Aug 12, 2026
@dmerand
dmerand marked this pull request as ready for review August 12, 2026 23:50
@dmerand
dmerand requested a review from a team as a code owner August 12, 2026 23:50
Copilot AI lite review requested due to automatic review settings August 12, 2026 23:50

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.

Pull request overview

Adds local validation for store execute GraphQL variables so only non-null JSON objects are accepted, preventing invalid variable payloads from reaching the GraphQL client.

Changes:

  • Introduces validateVariables to reject null, arrays, and primitive JSON values (and rejects explicitly empty --variables input).
  • Preserves existing malformed-JSON and missing-file error paths while rethrowing the new validation AbortErrors unchanged.
  • Adds regression tests for invalid inline/file variables and a changeset documenting the user-facing behavior change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/store/src/cli/services/store/execute/request.ts Adds local variables parsing/validation and new AbortError paths for invalid variable shapes.
packages/store/src/cli/services/store/execute/request.test.ts Adds coverage for invalid variables inputs and acceptance of {} variables.
.changeset/fuzzy-store-variables.md Declares a patch changeset for rejecting invalid variables before requests are sent.

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

Comment thread packages/store/src/cli/services/store/execute/request.ts
Comment thread packages/store/src/cli/services/store/execute/request.test.ts Outdated
Assisted-By: devx/2f4bde52-9531-4910-bbc1-5ed7182a4a59
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.

2 participants