fix(widget): gate http localhost to dev in sandbox origin check - #7057
Open
BlackPool25 wants to merge 1 commit into
Open
fix(widget): gate http localhost to dev in sandbox origin check#7057BlackPool25 wants to merge 1 commit into
BlackPool25 wants to merge 1 commit into
Conversation
Only allow http for localhost/127.0.0.1 when the sandbox itself is served over http (vite dev). In production the sandbox is https, so http localhost is not trusted. Uses window.location.protocol check to keep dev working while blocking same-host http trust in prod. Closes koala73#7055
|
@BlackPool25 is attempting to deploy a commit to the World Monitor Team on Vercel. A member of the Team first needs to authorize it. |
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
Gate
httpforlocalhost/127.0.0.1inpublic/wm-widget-sandbox.htmlto dev only (window.location.protocol === 'http:'). In production the sandbox is served overhttps, sohttp://127.0.0.1:* -> false.https://127.0.0.1still allowed,https://evil.com -> falseunchanged.src/utils/widget-sanitizer.ts:154keeps'*'with existing comment — iframe issandbox="allow-scripts"withoutallow-same-origin(opaque origin), so'*'is required for delivery; gating is done viaisAllowedParentOrigin+ per-widgetid/token+event.sourcecheck.Type of change
Affected areas
/api/*)Checklist
grep -n isAllowedParentOrigin public/wm-widget-sandbox.htmlandnode -eforhttp://127.0.0.1:8787(dev true, prod false)Closes #7055
Verification