Repository navigation
Conversation
jek
added this pull request to stack #8969
October 21, 2026 00:00
app security review
jek
force-pushed
the
app-security/support-json-schema-review
branch
from
October 21, 2026 00:46
b6029d4 to
34b0e76
Compare
jek
marked this pull request as ready for review
October 21, 2026 13:57
isaacroldan
reviewed
Oct 22, 2026
Contributor
There was a problem hiding this comment.
I'm just trusting both types.ts and result.ts are correct, will tophat also
isaacroldan
approved these changes
Oct 22, 2026
gonzaloriestra
approved these changes
Oct 22, 2026
| * The stored values of each closed enum, mapped to their public values. A new stored value fails to compile until | ||
| * it is mapped. | ||
| */ | ||
| const SEVERITIES: Record<Severity, AppSecurityCheck['severity']> = {high: 'high', medium: 'medium', low: 'low'} |
Contributor
There was a problem hiding this comment.
Could we assign unchanged enum values directly instead of keeping identity maps such as SEVERITIES, PRECEDENCES, DISPOSITIONS, CONFIDENCES and LANGUAGE_SUPPORT?
The typed projections already reject values that don't fit the public schema. We could keep maps for actual conversions, such as not_applicable to not-applicable.
Contributor
Author
There was a problem hiding this comment.
Done: SEVERITIES, PRECEDENCES, DISPOSITIONS, CONFIDENCES and LANGUAGE_SUPPORT are gone, and those values are assigned directly. The maps that convert spellings stay.
jek
force-pushed
the
app-security/support-json-schema-review
branch
from
October 22, 2026 15:23
34b0e76 to
ea4d549
Compare
4 tasks
github-merge-queue
Bot
removed this pull request from the merge queue because a pull request earlier in the stack was removed
Oct 22, 2026
github-merge-queue
Bot
removed this pull request from the merge queue because a pull request earlier in the stack was removed
Oct 22, 2026
`securityReview` now returns the reviewed results and the commands that the review suggests, instead of rendering them and setting the exit code. The command passes them to a presenter in security-review/, which renders the review and sets exit code 1 when `--blocking` is breached. The JSON codec will live beside it, as for the other app security commands. The text output and exit codes don't change.
`--json` prints the combined checks with every finding, whatever `--verbose`, beside the results files they come from, the latest scan's detection and coverage, and the app. `valid` and `blocking` report the `--blocking` policy; a breach still exits 1, after the result is printed. Paths are absolute, lines and columns are one-based as the results files record them, and stored enum values are kebab-case. An invalid results file aborts with the `results-file-invalid` code and lists each file's path and errors in `details.files`. An unknown `--check-id` aborts with `unknown-check-id` and lists the unknown IDs in `details.checkIds`, so callers can branch without parsing the message. The scope, scan directory and blocking definitions are shared, so that `check` can reuse them.
The results files' reader accepted any number as a line, column, check version, scanned file count or skipped file size, and any string as a check's docs_url. The CLI never writes such values, and `review --json` couldn't show them: a hand-edited line 0 made it fail with an unexpected error. The reader now rejects them, so `review` reports the file as invalid in text and JSON, with the `results-file-invalid` code and the steps to regenerate it.
jek
force-pushed
the
app-security/support-json-schema-review
branch
from
October 22, 2026 19:43
ea4d549 to
e3d8ebb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to https://github.com/shop/issues-develop/issues/23885
WHY are these changes introduced?
app security reviewis the only combined view of the deterministic and agent results: it applies check precedence, suppressions and result ages. Coding agents currently read it from terminal boxes and have to rejoin paths and commands that wrap across lines.WHAT is this pull request doing?
Adds
--jsontoapp security review. The result has:validandblocking: {level, blockedCheckCount}.validisfalseexactly when--blockingfails; the result is still printed, and the command exits 1.resultsFiles.deterministicandresultsFiles.agent, each with itspath,generatedAt,engineandscope, ornullwhen the file is missing.scopeDifferscompares the two scopes.detectionandcoveragefrom the latest scan.checks, after--check-id. Each check has its metadata, each source's own result (bySource) and every finding, whatever--verbosesays. Deterministic findings carryfix; agent findings carryconfidence,reasoningandsuppression.How values appear:
not-applicableandstructured-config.nullwhen they can't be parsed.null.New error codes:
results-file-invalid, withdetails.files: [{path, errors}];unknown-check-id, withdetails.checkIdslisting the unknown IDs.Commits:
securityReviewreturns the reviewed results, and a presenter insecurity-review/result.tsrenders them and sets the exit code. No behaviour change.--json. The scope, scan directory and blocking definitions go in the shared module, forcheck.line: 0, adocs_urlthat isn't a URL, or a fractional version.reviewnow reports such a hand-edited file as invalid, in both formats. Before,--jsonfailed as an unexpected error, and the text view showedfile:0. This commit has its own patch changeset. The JSON output is covered by Add typed JSON output toapp security clean#8963's changeset.How to manually test your changes?
Build once and run the local CLI directly, so nothing else reaches stdout:
To see
results-file-invalid, set any"line"in.shopify/app-security/<results key>/deterministic-findings.jsonto0and runreviewagain, with and without--json.Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add