-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: enrollment overlay in Django 4.0.x #793
Conversation
Noting that this branch (and |
a7dec6c
to
1dfb5cc
Compare
1dfb5cc
to
9ed26ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that's really all the changes that are needed to upgrade to Django 4? Were you able to test the application end to end to verify nothing else in the success path is broken?
Yep, tested the success path end-to-end. A lot of the work had already been done in #256 and #268. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work on this @angela-tran!! 🔎 🐛 💥
I tested the end-to-end flow locally and it all worked ✅
Shared your discovery: krakenjs/post-robot#84 |
Yesssss 👏 |
Closes #283
Summary
This PR sets
SECURE_CROSS_ORIGIN_OPENER_POLICY
tosame-origin-allow-popups
, which is the most secure option that still allows the overlay to work.This setting was introduced in Django 4.0.x and by default, sets the
Cross-Origin-Opener-Policy
header tosame-origin
, which prevents cross-origin popups from accessing their opener's browsing context. Prior to Django 4.0.x, the header was unset.If you look through the Javascript of our enrollment overlay, you'll notice that it makes use of
Window.postMessage()
to communicate with the Benefits window and needs to be able to store some variables on that window. So, it makes sense that this header value breaks it, since with it,Other notes
Cross-Origin-Opener-Policy
: https://web.dev/why-coop-coep/#coopAutomatically pretty print in Sources Panel
: https://stackoverflow.com/a/61816945