Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Schema Loading for Content Security Policy #43

Open
micchickenburger opened this issue Apr 8, 2023 · 0 comments
Open

Dynamic Schema Loading for Content Security Policy #43

micchickenburger opened this issue Apr 8, 2023 · 0 comments

Comments

@micchickenburger
Copy link

The Content Security Policy HTTP header should disallow unsafe-inline as a best practice. However, the schema data uses an inline script element.

Some stack overflow links which discuss this problem:

Some of these questions and answers are pretty old, but the general consensus seems to be that loading an external file will not work, but loading a script which generates the JSON+LD script containing the schema data dynamically should work.

A Content Security Policy script-src directive could also include nonces, but this requires a server and may not be suitable for a statically generated site. The directive also supports hashes, but for a blog or site with a lot of pages, one may end up with a unmaintainable quantity of hashes to add to the security header.

This issue is a feature request to add support for Content Security Policies. I think the dynamic generation approach may be the only way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant