Skip to content
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

Make ContentFrame allow cross-origin clipboard-write permission #6003

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lms/static/scripts/frontend_apps/components/ContentFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export default function ContentFrame({ url, iframeRef }: ContentFrameProps) {
// too).
//
// "autoplay" - Enables Play button to work without first clicking on video
// "clipboard-write" - Used by "Copy transcript" button
// "clipboard-write *" - Used by: Via's video player, the Hypothesis client sidebar
// "fullscreen" - Enables full-screen button in player
allow="autoplay; clipboard-write; fullscreen"
allow="autoplay; clipboard-write *; fullscreen"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered what the value was if the origin is not explicitly specified. According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy for the allow attribute it is 'src' (ie. same origin as the URL in the iframe's src attribute).

In the context of Via's video player, the origin of the video player itself matches 'src', which explains why this worked. However the 'src' origin doesn't match the client's sidebar, which is why we're having to add the wildcard here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I tried to find a piece of documentation explaining that and couldn't find it for some reason.

className={classnames(
// It's important that this content render full width and grow to fill
// available flex space. n.b. It may be rendered together with grading
Expand Down