Remove lax Shopify API key secret check - #8503
Open
francisbeaudoin wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, aligns with the stated goal, and is covered by updated tests; remaining feedback is minor precision/wording.
Pull request overview
This PR narrows App Doctor’s secret detection to avoid false positives by removing the heuristic that treated any api_key / client_id / SHOPIFY_API_KEY assignment containing 32 hex characters as a hardcoded Shopify API key, while keeping detection for Shopify API secrets and prefixed tokens intact.
Changes:
- Removed the generic 32-hex “Shopify API key” detection pattern from committed-secret scanning.
- Removed the now-unneeded special-case exemption for
shopify.app*.tomlclient IDs. - Updated secret safety tests and added a changeset documenting the user-facing behavior change.
File summaries
| File | Description |
|---|---|
| packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts | Removes the generic Shopify API key pattern and the shopify.app*.toml exemption path. |
| packages/app/src/cli/services/app-doctor-engine/tests/secret-safety.test.ts | Updates fixtures/assertions to ensure generic 32-hex client IDs are not reported as secrets. |
| .changeset/remove-shopify-api-key-secret-check.md | Documents the user-visible reduction in false positives as a patch changeset. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| '@shopify/app': patch | ||
| --- | ||
|
|
||
| Remove app doctor detection of generic 32-character Shopify API keys. |
Comment on lines
280
to
+285
| const secrets = result.issues.filter((issue) => issue.id === 'COMMITTED_SECRET') | ||
| expect( | ||
| secrets.some((issue) => issue.location.file === 'shopify.app.toml' && issue.title.includes('Shopify API key')), | ||
| ).toBe(false) | ||
| expect(secrets.some((issue) => issue.location.file === 'shopify.app.toml' && issue.title.includes('API key'))).toBe( | ||
| false, | ||
| ) | ||
| expect(secrets.some((issue) => issue.location.file === 'shopify.app.staging.toml')).toBe(false) | ||
| expect(secrets.some((issue) => issue.location.file === 'app.js')).toBe(true) | ||
| expect(secrets.some((issue) => issue.location.file === 'app.js')).toBe(false) |
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.
Why
App doctor currently treats any
api_key,client_id, orSHOPIFY_API_KEYassignment containing 32 hex characters as a hardcoded Shopify API key. That pattern is too broad and can flag generic/public 32-character identifiers, such as public client IDs in application codeWhat changed
shopify.app*.tomlclient IDs because it is no longer needed.Testing
pnpm vitest run packages/app/src/cli/services/app-doctor-engine/tests/secret-safety.test.tspnpm prettier --check packages/app/src/cli/services/app-doctor-engine/rules/secret-rules.ts packages/app/src/cli/services/app-doctor-engine/tests/secret-safety.test.ts .changeset/remove-shopify-api-key-secret-check.md