Lighthouse: Unrecognized Content-Security-Policy directive 'require-trusted-types-for'

Created on 29 Apr 2020  Â·  5Comments  Â·  Source: GoogleChrome/lighthouse

Describe the bug
The directive 'require-trusted-types-for' is legit, but it says unrecognized CSP directive.

To Reproduce
Steps to reproduce the behavior:

  1. Go to web.dev
  2. Test https://aashutosh.dev
  3. In report click on best practices.
  4. It shows this error.

Expected behavior
I think no browser error should log (due to 'require-trusted-types-for') while web.dev is visiting the site for report generation.

Screenshots
image

PS: Please correct me if I misinterpreted something completely.

PSLR needs-priority pending-close web.dev

All 5 comments

transferring to Lighthouse team

@aashutoshrathi it looks like you removed this directive from your CSP, right?

If the console logged it, this is coming from Chromium. I suggest making an issue on crbug.com if this doesn't align with your expectations.

looks like it's an experimental feature in chrome. https://caniuse.com/#feat=mdn-http_headers_csp_content-security-policy_trusted-types and we don't enable experiments in the env. that powers web.dev

The article indicates they're supported in Chrome 83. Stable is still 81. It's very possible chrome stable emits this browser error into the console. (Not ideal, but that's how it goes sometimes.. forward compat is hard.)

This isn't a Lighthouse error, though. We're just reporting that Chrome's console has errors in it.

Yeah, @paulirish I currently commented that particular CSP Directive for a while. 😅 (Since needed to show audit to someone else).

image

Thanks for the quick followup. @connorjclark and @paulirish

Was this page helpful?
0 / 5 - 0 ratings