fix(RemoteAsset): ignore base64 data URI images#1222
Open
andershagbard wants to merge 3 commits into
Open
Conversation
Data URIs (e.g. `src="data:image/gif;base64,..."`) are self-contained and do not create external HTTP connections, so the RemoteAsset check should not flag them. Adds an `isDataUri` helper and an early-return guard in `checkHtmlNode` alongside the existing hash-URL guard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
graygilmore
reviewed
Jun 2, 2026
Contributor
graygilmore
left a comment
There was a problem hiding this comment.
Love this! Two small tweaks suggested.
Co-authored-by: Gray Gilmore <graygilmore@gmail.com>
Handles `{{ 'data:image/gif;base64,...' | img_tag }}` patterns the same
way HTML src attributes with data URIs are already handled.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
graygilmore
approved these changes
Jun 3, 2026
Contributor
graygilmore
left a comment
There was a problem hiding this comment.
Thanks @andershagbard! Just needs a changeset which you can create with pnpm changeset add. A patch is fine for this.
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.
Summary
RemoteAssetcheck was incorrectly flaggingsrcattributes containing base64-encoded data URIs (e.g.src="data:image/gif;base64,...") as needing to be served via the Shopify CDN.isDataUrihelper (mirrors the existingisHashUrlhelper) and an early-return guard incheckHtmlNodeso data URIs are silently skipped.Example
{{! Before: this was incorrectly reported as an offense }} <img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" />Test plan
should not report an offense for base64 encoded data URIs— single GIF data URI passesshould not report an offense for various base64 data URI image formats— PNG, JPEG, SVG, WebP data URIs all passshould still report an offense for remote images alongside base64 images— mixed case: base64 is ignored, remote URL is still caughtremote-asset/index.spec.tspass🤖 Generated with Claude Code