Skip to content

Add typed JSON output to app security record - #8964

Open
jek wants to merge 2 commits into
app-security/support-json-schema-cleanfrom
app-security/support-json-schema-record
Open

jek wants to merge 2 commits into
app-security/support-json-schema-cleanfrom
app-security/support-json-schema-record

Conversation

@jek

@jek jek commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Coding agents pipe their findings document into app security record. When the document is rejected, they have to read the errors from a terminal box before they can fix them and try again.

WHAT is this pull request doing?

Adds --json to app security record:

{"status": "success", "app": {"directory": "/path/to/app", "configurationPath": "/path/to/app/shopify.app.toml", "clientId": "1234"},
 "resultsDirectory": "/path/to/app/.shopify/app-security/shopify.app",
 "path": "/path/to/app/.shopify/app-security/shopify.app/agent-findings.json", "checkCount": 2, "findingCount": 1}
  • Nothing on stdin fails with the code findings-document-missing.
  • A rejected document fails with the code findings-document-rejected, and details.errors lists every error. A document is rejected when it isn't valid JSON, is too large, or fails validation. As before, nothing is written.

The first commit moves the terminal presenter to security-record/result.ts without changing behaviour.

How to manually test your changes?

Build once and run the local CLI directly, so nothing else reaches stdout:

pnpm nx build cli
alias shopify-dev="node $PWD/packages/cli/bin/dev.js"
shopify-dev app security check --path <app> --no-input --skip-instructions
shopify-dev app security record --path <app> --json < /dev/null                    # findings-document-missing
echo '{"schema_version": 1}' | shopify-dev app security record --path <app> --json  # findings-document-rejected, with details.errors

For an accepted document, copy the example from step 4 of shopify-dev app security instructions --path <app> and pipe it the same way.

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

jek added 2 commits October 20, 2026 16:43
The record result's JSON codec and presenter will live in
security-record/, beside its schema, as for clean. The text output
doesn't change.
`--json` prints the recorded agent-findings.json, its results directory,
the app it belongs to, and the number of checks and findings recorded.

Without a findings document on stdin, the command aborts with the
`findings-document-missing` code. A rejected document aborts with
`findings-document-rejected` and lists every error in `details.errors`,
so callers can fix them all without parsing the message.
@jek
jek added this pull request to stack #8969 October 21, 2026 00:00
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Oct 21, 2026
@jek jek changed the title app security/support json schema record Add typed JSON output to app security record Oct 21, 2026
@jek
jek marked this pull request as ready for review October 21, 2026 13:50
@jek
jek requested review from a team as code owners October 21, 2026 13:50

This branch has not been deployed

No deployments
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.

1 participant