You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add allowedDomains check for RemoteAsset theme checker
Enhances developer experience by validating the remote assets (scripts,
stylesheets) are loaded not only from Shopify CDNs but now approved
domains. This prevents potential performance risks and incorrect errors
from loading resources from untrusted sources, forcing developers to go
and enable a source if it's _required_
The implementation includes:
- Schema property for configuring allowedDomains
- Domain validation against configured allow list
- Test coverage for both allowed and non-allowed domains
Reverted minor changeset to patch bump
Fixed prettier issues
Refactor domain list from global to parameter
Changes domain validation to accept allowedDomains as a parameter
instead of mutating a global array. This improves code clarity and
testability by making data flow explicit.
The change reduces side effets by:
- Removing relince on shared mutable state
- Making dpendencies clear through function signatures
- Enabling better unit testing of domain validation logic
Added file formatting
Add normalisaztion & tests.
- Added normalization to domains
- Added extra tests to test against and for normalisation of strings.
Update domains in test
refactor: remove redundant regex validation in normaliseAllowedDomains
- Remove regex pre-validation since new URL() already enforces strict
URL standards
- Simplify code by relying solely on new URL() for validation and
normalisation
Fixed issue where malformed URLs were throwing type errors.
The test case urls were malformed as expected, but the new URL
constructor was throwing Type Errors, which is expected if not wrapped
in a try...catch block.
Fixed by wrapping in a try...catch and returning false when malformed.
0 commit comments