App Security: let agents choose, check and rerun a scope - #8740
Conversation
|
/snapit |
|
🫰✨ Thanks @jek! Your snapshot has been published to npm. Built from Test the snapshot by installing your package globally: pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20261002130601Caution After installing, validate the version by running |
776d9ca to
2f30f7f
Compare
26686db to
c23b4d8
Compare
c23b4d8 to
e57a89c
Compare
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/api/app-management.d.ts@@ -7,7 +7,6 @@ export declare const appManagementAppLogsUrl: (organizationId: string, cursor?:
status?: string;
source?: string;
}) => Promise<string>;
-export declare const appManagementChannelSpecExportUrl: (organizationId: string, appId: string) => Promise<string>;
export interface RequestOptions {
requestMode: RequestModeInput;
}
|
e57a89c to
b05efb6
Compare
Add check --list-files, render rerun commands from the selection and the typed scope flags, and record the scope on both sides so review can flag a mismatch. The instructions name the working directory and have the agent settle the scope before scanning. Cover the layout catalogue.
Run the real command with --without-app-config and --exclude, and check the results key, the selection, the recorded scope and the unresolved config checks. No other test scans with no app configuration file.
b05efb6 to
181ddef
Compare
jplhomer
left a comment
There was a problem hiding this comment.
Agentic check ran successfully 👍
dmerand
left a comment
There was a problem hiding this comment.
Small change request to maintain backwards compatibility. Should be quick and/or we can discuss.
| ...documentBase, | ||
| source: zod.literal('agent'), | ||
| engine: zod.object({name: zod.literal(ENGINE_NAME), version: zod.string()}), | ||
| scope: createScopeSchema(), |
There was a problem hiding this comment.
This comment is the change request:
scope is required while schema_version stays 1, so stored results from an earlier CLI can no longer be read.
I verified this with the compiled CLI: agent-findings.json recorded before this change has no scope, and review now exits 1 with "The App Security results could not be loaded because a results file is invalid" and the detail scope: Required. The same applies to deterministic findings without the new coverage.scope and coverage.scan_directories. The record input also stays at version 1 while requiring scope.
If old results should keep loading, please bump the version or add a legacy representation (for example an unknown-scope marker with guidance to run check again), and make the error explain the format change. Please don't invent an empty scope for historical results — that would misstate what was scanned.
There was a problem hiding this comment.
We're intentionally not keeping compatibility here.
EA wrote a flat .shopify/app-security/*.json layout that this stack no longer reads; the keyed / layout and the scope fields ship in the same merge, so no released CLI writes a keyed results file without scope.
A scope-less file can only come from an intermediate stack build (#8737–#8739 alone), which won't ship. Version 1 is effectively the first version of the keyed layout. Pre-GA, we don't carry EA formats forward.
There was a problem hiding this comment.
Great, makes sense. I'll adjust to approved + leave the rest to your discretion.
review printed a check command without the scope, so following it scanned less (or more) than the results it summarised.
Every other free-form value in the results files is redacted, but the scope's --include-dir and --exclude values and the scan directories were stored as typed. Both results files redact them the same way, so they still compare equal.
"Nothing is recorded" read as "nothing is written", but selecting the app can create .shopify/project.json as every app command does.
|
| Command | Flag |
|---|---|
app:security:check |
--ignore |
WHY are these changes introduced?
With
--include-dir,--excludeand--no-git-ignore, an agent needs to settle on a scope, verify it, rerun it the same way, and record which scope its findings cover.WHAT is this pull request doing?
check --list-filesprints the gathered paths (or{"files": [...]}with--json) without scanning.--path, the selection and the typed scope flags in a fixed order, relative to the working directory, which the instructions now name.instructionstell the agent to choose the scope with--list-filesfirst.checkrecords the scope and scan directories incoverage;recordrequires the agent'sscope;reviewshows both and notes when they differ.How to manually test your changes?
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add