w3c / w3c/csswg-drafts

[mediaqueries-5] Account for CSP restrictions in the scripting feature

Open
#8,653 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

mediaqueries-5
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Regarding the @media scripting features, value none, the current specification reads:

[...]the value of the scripting media feature should be enabled or initial-only if scripts originating on the same domain as the document are allowed to run, and none otherwise.

Security and privacy browser extensions such NoScript, uBlock Origin or uMatrix currently use CSP directives (typically script-src and script-src-elem) to turn off JavaScript on certain sites of users' choice, and use DOM manipulation to display the content of <noscript> elements (which are not affected by CSP) and provide users with the authors' intended feedback. Of course the JavaScript-toggled CSS classes approach works out of the box.

It would be great if this new feature took in account CSP disabling script execution on the document, making explicit that the value should be none for that case. Otherwise the aforementioned tools would need to scan all the CSS rules applied to the page and manipulate them to force those matching scripting none, which would a ugly, inefficient hack.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Media Queries Level 5 definition of the scripting media feature, especially the none value, and review the issue's CSP examples involving script-src and script-src-elem. Done means reaching agreement on the CSP interaction and updating the specification's normative wording accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.