Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

enable strict csp for exported site #1175

Open

Description

Is your feature request related to a problem? Please describe.
html files generated by npm run export contain inline scripts (and in case of rollup these even use eval)
The documentation suggests using a runtime injected nonce via server.js but this is not applicable to export.

Describe the solution you'd like
I'd prefer no inline scripts at all. If that is not an option, hash based policies in meta could be possible. ( https://content-security-policy.com/examples/meta/ )

Describe alternatives you've considered
a) Serving with a lax csp (or none at all)
b) not using sapper export

How important is this feature to you?
deal-breaker in production environments

Additional context

Activity

  1. pgjones commented on May 26, 2020

    @pgjones
    Contributor

    You can set the nonce to a placeholder value in the server and it will be present in the exported html. The server you use for the exported files can then replace the placeholder.

  2. pgjones commented on May 27, 2020

    @pgjones
    Contributor

    @dominikg For the nonce to be effective you will need to generate a new one on every request

    The server must generate a unique nonce value each time it transmits a policy.
    source

    Did you mean something else?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions