addons-linter icon indicating copy to clipboard operation
addons-linter copied to clipboard

Reject nonces, hashes and remote values, at least in script-src-elem and script-src-attr

Open Rob--W opened this issue 3 years ago • 0 comments

In #3007 the issue was raised that the linter doesn't recognize script-src-elem and script-src-attr. In #4452 this was fixed by re-using the existing validation logic of script-src.

The script-src validation logic is needlessly complicated. In MV3, the only permitted values for script-src are 'self', 'wasm-unsafe-eval' and 'none' (but 'self' is documented to be required in script-src because otherwise an extension is going to be quite useless).

At the very least, since script-src-elem and script-src-attr are new, we can do the following:

  • script-src-elem: if specified, may only contain 'self' or 'none'
  • script-src-attr: if specified, may only contain 'none' (in particular, nonce and hashes are NOT supported - https://bugzilla.mozilla.org/show_bug.cgi?id=1789759)

Additionally:

Rob--W avatar Oct 13 '22 14:10 Rob--W