Skip to content

Commit

Permalink
Fix: Add video service providers to CSP allow list
Browse files Browse the repository at this point in the history
This adds the URLs of currently used video services to the CSP allow list for
type frame so that video preview thumbnails are shown in backend.

Before this fix the video preview thumbnails are not shown but instead
following message is logged to console:
`Refused to frame 'https://www.youtube-nocookie.com/' because it violates the
following Content Security Policy directive: "frame-src 'self' data:".`
  • Loading branch information
podarcis committed May 10, 2024
1 parent 558c7c2 commit f512fe9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Security/ContentSecurityPolicyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ class ContentSecurityPolicyHandler implements LoggerAwareInterface
self::SCRIPT_OPT => [
'https://buttons.github.io/buttons.js', // GitHub star button on login page
],
self::FRAME_OPT => [
'https://www.youtube-nocookie.com/', // Video preview thumbnail for YouTube
'https://www.dailymotion.com/', // Video preview thumbnail for Dailymotion
'https://player.vimeo.com/', // Video preview thumbnail for Vimeo
],
];

public function __construct(protected Config $config, protected array $cspHeaderOptions = [])
Expand Down

0 comments on commit f512fe9

Please sign in to comment.