Skip to content

Content-Security-Policy CSP regressions: .cast, .pdf #37257

@silverwind

Description

@silverwind

asciicast

Regression from #37232. To reproduce:

  • Upload a .cast file into repo (ASCIICast)
  • Open file view in Firefox, it does not load and browser logs this error:
Content-Security-Policy: The page’s settings blocked WebAssembly (script-src) from being executed because it violates the following directive: “script-src * 'nonce-a7a188e55b1913099d55c3221896d920'” (Missing 'wasm-unsafe-eval' or 'unsafe-eval')

And this one:

Uncaught (in promise) CompileError: call to WebAssembly.instantiate() blocked by CSP
    __wbg_load core-DnNOMtZn.js:286
    __wbg_init core-DnNOMtZn.js:392
    init core-DnNOMtZn.js:433
    async* core-DnNOMtZn.js:2582

The solution is to move the asciicast render to iframe, but the current framework doesn't work.

Because iframe srcdoc inherits the parent page's CSP.

To fix the problem: the iframe window shouldn't not use parent windows' CSP

external pdf

If external render outputs pdf binary content, it is also broken. srcdoc doesn't work for PDF

To reproduce:

[markup.in-iframe]
ENABLED = true
FILE_EXTENSIONS = .in-iframe
RENDER_CONTENT_MODE = iframe
RENDER_COMMAND = cat /path/to/file.pdf
RENDER_CONTENT_SANDBOX = disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions