Repository navigation
Conversation
Contributor
Author
|
/snapit |
This branch has not been deployed
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 are these changes introduced?
LIQUID_UNSAFE_RENDERflagged everyblock.settings.*/section.settings.*output the same way, includingselect/checkboxsettings whose values are fixed by the extension schema (e.g. a layout select withleft|rightoptions, or a boolean toggle used as a class). Those closed, developer-defined value domains cannot carry merchant-injected markup in HTML text or ordinary attribute contexts.WHAT is this pull request doing?
liquid-rules.ts: extract the{% schema %}JSON from the same file, map settingid-> type, and thread it intoliquidUnsafeRenderVisitor. Exempts only exactblock.settings.<id>/section.settings.<id>(no property access) inhtml_text/ non-URLhtml_attributecontexts forcheckbox,range, andselect/radiowhere everyoptions[].valuepasses a conservative inert charset (no<,>,&, quotes, backtick, whitespace, or=). Missing, unparseable, or duplicated schema, unsafe option values, and all other types fall through to previous behaviour (fail-closed).liquidExecutableContextVisitor(UNSAFE_INNERHTML), JavaScript/executable contexts, URL attributes, metafields.LIQUID_UNSAFE_RENDERv1 -> v2 inscanners/index.tsandchecks/LIQUID_UNSAFE_RENDER.md, regenerateschecks/embedded.ts, adds the missing version-pin assertion, and adds the targeted test matrix (inert select clean in text/attribute, bad option flagged, checkbox/range clean, text/richtext flagged, script/onclick flagged, missing/unparseable schema flagged, escaped stays clean).Follow-up (out of scope): update the shopify.dev app-security check page for
LIQUID_UNSAFE_RENDERinshop/worldto describe the typed exemption.How to manually test your changes?
In a theme app extension block, add a
{% schema %}with aselectsetting (inert options), acheckbox, and atextsetting; render each unescaped in element text and in aclassattribute, then run the app-security scan. The select/checkbox outputs should no longer raiseLIQUID_UNSAFE_RENDER, while the text output still should.