Skip to content

feat: enforce allowed message origin in non-development environment#24

Merged
lihbr merged 1 commit intomasterfrom
lh/allowed-origins
Apr 9, 2026
Merged

feat: enforce allowed message origin in non-development environment#24
lihbr merged 1 commit intomasterfrom
lh/allowed-origins

Conversation

@lihbr
Copy link
Copy Markdown
Member

@lihbr lihbr commented Apr 8, 2026

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: https enabled, Prismic-owned domain.

Checklist

  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

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._onPublicMessage so that, outside development, incoming postMessage events are ignored unless they come from https:// and a set of trusted Prismic/Wroom-owned domains.

Updates ChannelReceiver tests to include origin in 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

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

Co-authored-by: DriesOlbrechts <driesolbrechts@gmail.com>
@lihbr lihbr mentioned this pull request Apr 8, 2026
3 tasks
@lihbr lihbr merged commit 4625090 into master Apr 9, 2026
13 checks passed
@lihbr lihbr deleted the lh/allowed-origins branch April 9, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant