Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a Content Security Policy (CSP) styling issue with lite-youtube@1.9.0 by making the per-request CSP nonce available to the component so it can nonce its runtime-injected shadow-DOM <style> tag and avoid style-src violations.
Changes:
- Set
window.liteYouTubeNonceto the request’scsp_noncein the base HTML head so all pages inheritingbase_index.htmlbenefit automatically.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2618 +/- ##
=======================================
Coverage 78.58% 78.58%
=======================================
Files 16 16
Lines 1975 1975
=======================================
Hits 1552 1552
Misses 423 423
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Skazitron
approved these changes
Jun 16, 2026
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.
Done
window.liteYouTubeNonceto the per-request CSP nonce inbase_index.html, just before theextra_metatagsblock.lite-youtube@1.9.0injects a<style>into its open shadow DOM at runtime. Ourstyle-srcdirective is nonce-based with no'unsafe-inline', so that injected style was blocked with a CSP violation and the player rendered unstyled.window.liteYouTubeNonceand stamps it onto the<style>it injects. Setting it before the deferred module upgrades the element lets the injected style satisfy our nonce-basedstyle-src.<script>in<head>), so it runs before the loader and covers every page that embeds a lite-youtube video without per-template edits.Affected pages (all embed lite-youtube and extend
base_index.html):https://canonical.com/maas
https://canonical.com/microcloud
https://canonical.com/anbox-cloud
https://canonical.com/solutions/automotive
https://canonical.com/solutions/education
https://canonical.com/solutions/financial-services
https://canonical.com/solutions/infrastructure/virtualization-solutions
https://canonical.com/public-sector
https://canonical.com/company
https://canonical.com/data/spark
https://canonical.com/careers/company-culture/progression
https://canonical.com/careers/hiring-process
https://canonical.com/case-study/oediv
https://canonical.com/case-study/oediv-de
https://canonical.com/knowledge/ubuntu-and-linux/what-is-linux-kernel
https://canonical.com/knowledge/security-and-compliance/what-is-software-supply-chain-security
https://canonical.com/knowledge/security-and-compliance/open-source-security
https://canonical.com/knowledge/internet-of-things/what-is-iot-security
https://canonical.com/knowledge/internet-of-things/yocto-vs-ubuntu-core
QA
Open the DEMO
Visit /careers/hiring-process (or any affected page below)
https://canonical-com-2618.demos.haus/maas
https://canonical-com-2618.demos.haus/microcloud
https://canonical-com-2618.demos.haus/anbox-cloud
https://canonical-com-2618.demos.haus/solutions/automotive
https://canonical-com-2618.demos.haus/solutions/education
https://canonical-com-2618.demos.haus/solutions/financial-services
https://canonical-com-2618.demos.haus/solutions/infrastructure/virtualization-solutions
https://canonical-com-2618.demos.haus/public-sector
https://canonical-com-2618.demos.haus/company
https://canonical-com-2618.demos.haus/data/spark
https://canonical-com-2618.demos.haus/careers/company-culture/progression
https://canonical-com-2618.demos.haus/careers/hiring-process
https://canonical-com-2618.demos.haus/case-study/oediv
https://canonical-com-2618.demos.haus/case-study/oediv-de
https://canonical-com-2618.demos.haus/knowledge/ubuntu-and-linux/what-is-linux-kernel
https://canonical-com-2618.demos.haus/knowledge/security-and-compliance/what-is-software-supply-chain-security
https://canonical-com-2618.demos.haus/knowledge/security-and-compliance/open-source-security
https://canonical-com-2618.demos.haus/knowledge/internet-of-things/what-is-iot-security
https://canonical-com-2618.demos.haus/knowledge/internet-of-things/yocto-vs-ubuntu-core
style-srcCSP violation referencing the injected inline style<lite-youtube>element's shadow root and confirm its<style>carries anonce="…"matching the page'sContent-Security-Policyheader nonceIssue / Card
Fixes WD-37159
Screenshots
[if relevant, include a before/after of the player styling]