feat: enforce allowed message origin in non-development environment#24
Merged
feat: enforce allowed message origin in non-development environment#24
Conversation
Co-authored-by: DriesOlbrechts <driesolbrechts@gmail.com>
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.
Resolves: #21
Description
This pull request builds on the idea of #21. When in a non-development environment, it enforces messages received by the receiver (i.e. Slice Simulator page on users' website) to come from a trusted origin:
httpsenabled, Prismic-owned domain.Checklist
Preview
How to QA 1
Note
Medium Risk
Adds origin filtering to cross-window message handling; misconfiguration or missing allowlist entries could break iframe communication in production environments.
Overview
Adds an origin allowlist check to
ChannelReceiver._onPublicMessageso that, outsidedevelopment, incomingpostMessageevents are ignored unless they come fromhttps://and a set of trusted Prismic/Wroom-owned domains.Updates
ChannelReceivertests to includeoriginin simulated events and adds coverage verifying that development accepts any origin while non-development rejects non-HTTPS and non-allowlisted domains.Reviewed by Cursor Bugbot for commit 9c3678e. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩