Skip to content

Fix App Security secret scanning false positives - #8592

Merged
lopez-mar merged 7 commits into
mainfrom
joshlarson/app-doctor-secret-false-positives
Sep 21, 2026
Merged

lopez-mar merged 7 commits into
mainfrom
joshlarson/app-doctor-secret-false-positives

Conversation

@jplhomer

@jplhomer jplhomer commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Fixes https://github.com/shop/issues-develop/issues/23957

Early-access partners were flooded with COMMITTED_SECRET findings for placeholders, .env.example templates, public client IDs, and Stripe publishable keys. A name match plus a non-empty value was enough to score -50 high, which fails the static-tier bar of provable facts.

WHAT is this pull request doing?

Score an env/secret file only when it contains a recognizable secret value — a Shopify credential prefix (shpat_, shpca_, shppa_, shpss_, shprt_, shpsb_, shptka_, shpua_) or another known credential format. Secret-sounding variable or key names (password, api_secret, …) are no longer evidence on their own, so placeholders and template env files never fire. Drop SHOPIFY_API_KEY / api_key and Stripe pk_ from secret detection. Keep fail-closed for real secrets when git status is unknown, but stop rendering that case as confirmed-tracked.

How to manually test your changes?

From an app with a committed .env.example of placeholders and a tracked .env that contains a real shpss_ / shpat_ token:

pnpm shopify app doctor --path /path/to/app --skip-instructions

Confirm the template is not reported and the real token still is.

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

@jplhomer
jplhomer requested a review from a team as a code owner September 18, 2026 15:50
Copilot AI lite review requested due to automatic review settings September 18, 2026 15:50
@github-actions github-actions Bot added the Area: @shopify/app @shopify/app package issues label Sep 18, 2026

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.

🟡 Changes recommended

Two moderate detection gaps and contradictory template guidance remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Fixes App Doctor secret-scanning false positives while preserving detection of valid credentials.

Changes:

  • Requires stronger evidence for committed-secret findings.
  • Adds template, placeholder, public-key, and git-status handling.
  • Updates guidance, tests, rule version, and patch changeset.
File summaries
File Summary
packages/app/src/cli/services/app-doctor-engine/tests/secret-safety.test.ts Adds regression coverage for refined secret detection.
packages/app/src/cli/services/app-doctor-engine/tests/deterministic-rules.test.ts Verifies deterministic rule versioning.
packages/app/src/cli/services/app-doctor-engine/scanners/index.ts Bumps the deterministic rule version.
packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts Implements evidence-based classification; moderate issues remain for multi-suffix templates and quoted JSON keys.
packages/app/src/cli/services/app-doctor-engine/checks/embedded.ts Updates embedded guidance; template guidance needs correction.
packages/app/src/cli/services/app-doctor-engine/checks/COMMITTED_SECRET.md Updates check documentation; template guidance needs correction.
.changeset/app-doctor-secret-false-positives.md Documents the patch release.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 4
  • Review effort level: Lite

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

Comment thread packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts Outdated
Comment thread packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts Outdated
Comment thread packages/app/src/cli/services/app-doctor-engine/checks/COMMITTED_SECRET.md Outdated
Comment thread packages/app/src/cli/services/app-doctor-engine/checks/embedded.ts Outdated
@jplhomer
jplhomer requested review from dmerand and jek September 18, 2026 16:25
Comment thread packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts Outdated
Comment thread packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts Outdated
Comment thread packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts Outdated
Comment thread packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts Outdated
Comment thread packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts Outdated
jplhomer and others added 6 commits September 21, 2026 12:22
Require a known credential format or a non-placeholder value before
scoring COMMITTED_SECRET, skip template env files and public client IDs,
and stop rendering unverified git status as confirmed-tracked.

Co-authored-by: AI (Pi/Grok 4.6) <noreply@pi.dev>
Match multi-suffix env templates, extract quoted JSON secret keys, and
clarify that template files still report known credential formats.

Co-authored-by: AI (Pi/Grok 4.6) <noreply@pi.dev>
Avoid ReDoS on (?:\.[^/]+)* when suffixes contain extra dots.

Co-authored-by: AI (Pi/Grok 4.6) <noreply@pi.dev>
Unquoted 32-hex Shopify secrets now match the quoted form. Assignment
scans no longer consume the next line or treat HAS_PASSWORD as a secret.

Co-authored-by: AI (Pi/Grok 4.6) <noreply@pi.dev>
Assisted-By: devx/044e1f3f-fe03-4f4c-8aa7-520114eab4a0
Assisted-By: devx/044e1f3f-fe03-4f4c-8aa7-520114eab4a0
@lopez-mar
lopez-mar force-pushed the joshlarson/app-doctor-secret-false-positives branch from 2b0f9ee to f1daa19 Compare September 21, 2026 16:23
@lopez-mar lopez-mar changed the title Fix App Doctor secret scanning false positives Fix App Security secret scanning false positives Sep 21, 2026
Assisted-By: devx/044e1f3f-fe03-4f4c-8aa7-520114eab4a0
@lopez-mar
lopez-mar added this pull request to the merge queue Sep 21, 2026
Merged via the queue into main with commit fb6e8fc Sep 21, 2026
54 of 55 checks passed
@lopez-mar
lopez-mar deleted the joshlarson/app-doctor-secret-false-positives branch September 21, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/app @shopify/app package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants