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

core(page-functions): set style in getOuterHTMLSnippet without violating CSP #13636

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

adamraine
Copy link
Member

Fixes #13630

@adamraine adamraine requested a review from a team as a code owner February 7, 2022 18:42
@adamraine adamraine requested review from connorjclark and removed request for a team February 7, 2022 18:42
@@ -10,7 +10,6 @@ import byteEfficiency from './test-definitions/byte-efficiency.js';
import byteGzip from './test-definitions/byte-gzip.js';
import cspAllowAll from './test-definitions/csp-allow-all.js';
import cspBlockAll from './test-definitions/csp-block-all.js';
import cspBlockAllM91 from './test-definitions/csp-block-all-m91.js';
Copy link
Member Author

Choose a reason for hiding this comment

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

Drive-by, test isn't useful anymore

@connorjclark connorjclark changed the title core: update style without violating the CSP core(page-functions): set style in getOuterHTMLSnippet without violating CSP Feb 7, 2022
@adamraine adamraine merged commit 5374d64 into master Feb 7, 2022
@adamraine adamraine deleted the style-attr-csp branch February 7, 2022 19:17
@@ -138,7 +138,17 @@ function getOuterHTMLSnippet(element, ignoreAttrs = [], snippetCharacterLimit =
dirty = true;
}

if (dirty) clone.setAttribute(attributeName, attributeValue);
if (dirty) {
// Style attributes can be blocked by the CSP if they are set via `setAttribute`.
Copy link
Member

Choose a reason for hiding this comment

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

love finding those CSP holes :D

Copy link
Member

Choose a reason for hiding this comment

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

IIRC constructable stylesheets are also not constrained by CSP but allow you to do the same stuff that is. 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSP issues caused by Lighthouse
4 participants