Skip to content

Add static frame-ancestors check to App Doctor - #8500

Merged
lopez-mar merged 7 commits into
Shopify:mainfrom
lopez-mar:app-doctor-static-frame-ancestors
Sep 9, 2026
Merged

Add static frame-ancestors check to App Doctor#8500
lopez-mar merged 7 commits into
Shopify:mainfrom
lopez-mar:app-doctor-static-frame-ancestors

Conversation

@lopez-mar

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

STATIC_FRAME_ANCESTORS already exists as an App Doctor product ID in the agentic pack, but the deterministic engine had no narrow implementation for the literal cases it can prove safely.

WHAT is this pull request doing?

  • Adds a deterministic STATIC_FRAME_ANCESTORS runner for embedded admin apps only.
  • Introduces a distinct embedded_app capability derived from root embedded = true in shopify.app.toml, separate from theme app-embed blocks.
  • Flags only literal wildcard or clearly permissive frame-ancestors tokens inside Content-Security-Policy text.
  • Keeps missing-CSP detection and nuanced policy construction in the agentic tier.
  • Adds negative fixtures for fixed allowlists, computed policies, non-embedded apps, and theme-only app-embed surfaces.
  • Updates JSON fixtures and a patch changeset for the new capability field.

Verification

  • pnpm exec vitest run packages/app/src/cli/services/app-doctor-engine/tests/deterministic-rules.test.ts packages/app/src/cli/services/app-doctor-engine/tests/scan-contract.test.ts packages/app/src/cli/services/app-doctor-engine/tests/trace.test.ts packages/app/src/cli/services/app-doctor-json.test.ts packages/app/src/cli/services/doctor-output.test.ts packages/app/src/cli/services/doctor.test.ts
  • pnpm --filter @shopify/app type-check
  • pnpm --filter @shopify/app lint

@lopez-mar
lopez-mar requested a review from a team as a code owner September 8, 2026 17:44

@jplhomer jplhomer 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.

Couple small questions!

Comment thread packages/app/src/cli/services/app-doctor-engine/scanners/index.ts
@lopez-mar

Copy link
Copy Markdown
Contributor Author

Good questions. appSourceFiles() is intentionally the framework-agnostic app-source boundary for STATIC_FRAME_ANCESTORS; reactRouterFiles() currently delegates to it, but keeping the names separate makes the execution contract explicit because existing source checks remain React Router-gated while the new app_source target is not. I also added regression coverage for headers.set, response.headers.append, res.setHeader, static concatenation, static template literals, and mixed frame-ancestors 'self' * source lists.

@dmerand dmerand 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.

Again, approved from the overall lens of CLI command membership. My agents had a couple of notes about the implementation that may be worth considering.

Comment thread packages/app/src/cli/services/app-doctor-engine/rules/csp-rules.ts
Comment thread packages/app/src/cli/services/app-doctor-engine/rules/csp-rules.ts
Assisted-By: devx/0434e4da-7c55-4ded-87bd-400bf4d8a927
Assisted-By: devx/0434e4da-7c55-4ded-87bd-400bf4d8a927
Assisted-By: devx/0434e4da-7c55-4ded-87bd-400bf4d8a927
Assisted-By: devx/0434e4da-7c55-4ded-87bd-400bf4d8a927
Assisted-By: devx/0434e4da-7c55-4ded-87bd-400bf4d8a927
Assisted-By: devx/0434e4da-7c55-4ded-87bd-400bf4d8a927
@lopez-mar
lopez-mar force-pushed the app-doctor-static-frame-ancestors branch from eede6ca to f84268b Compare September 9, 2026 21:36
@lopez-mar
lopez-mar enabled auto-merge September 9, 2026 21:38
@lopez-mar
lopez-mar disabled auto-merge September 9, 2026 21:40
Assisted-By: devx/3ac90870-9844-4116-81bc-cd8883bd74f9
@lopez-mar
lopez-mar added this pull request to the merge queue Sep 9, 2026
Merged via the queue into Shopify:main with commit ce5185e Sep 9, 2026
29 checks passed
@lopez-mar
lopez-mar deleted the app-doctor-static-frame-ancestors branch September 9, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants