Repository navigation
fix(rules): security/sri exempts Shopify platform scripts and adds exempt_hosts #546 - #879
Merged
Merged
Conversation
…empt_hosts #546 cdn.shopify.com /shopifycloud/ and /storefront/ are exempt by path prefix; theme and app assets elsewhere on the host are still checked. exempt_hosts takes bare hostnames, validated by config validate and the audit preflight. Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/546-sri-shopify-exempt
branch
from
October 16, 2026 23:10
6c23d42 to
7588c82
Compare
nc9
marked this pull request as ready for review
October 16, 2026 23:10
|
Reviewed the diff for
What I checked:
|
Contributor
Author
|
Review triage (7588c82): no change pushed. The double blank line and the per-page options parse are cosmetic; the latter matches the other rules that take options. The |
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.
Closes #546
What changed
security/sriexemptscdn.shopify.comby path prefix,/shopifycloud/and/storefront/: Shopify injects those scripts into every store and updates them in place. The rest ofcdn.shopify.com(theme assets under/s/files/, theme app extensions under/extensions/) is still checked.exempt_hosts(array of bare hostnames, matched exactly, ignoring case and a terminal dot). Validated by its zod schema, sosquirrel config validateand the audit preflight name a bad entry:[rule_options."security/sri"] exempt_hosts.0: must be a hostname such as static.example.com, with no scheme, port or path.exempt_hostsinstead of "disable the rule" for a self-updating script.Acceptance criteria
cdn.shopify.com/shopifycloud/and/storefront/scripts not reportedexempt_hostsdocumented (Options table + example) and validatedintegritystill flaggedcdn.shopify.comtheme/app asset outside the prefixes still flaggedsri.mdxlists the path-prefix exemptions and the optionpackages/rules/tests/sri.test.ts: the two Shopify URLs not reported; a theme asset with?v=and an-latestapp extension reported;cdn.jsdelivr.net/npm/[email protected]/x.jsreported; a listed host not reported, an unlisted one reported; option validation; prefix only from the path startTypecheck (rules), oxlint on changed files,
sri,rule-options-check,template-verdict-inputs,noscript-contenttests pass, codex review (2 rounds, clean).