dotnet / dotnet/aspnetcore

[Templating] Add a CSP meta header to our template layouts

Open
#7,863 1 comment 1 reaction 0 assignees View on GitHub
affected-medium area-mvc enhancement feature-templates severity-major
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

We can add a reasonable CSP policy in the meta tag of our layouts to tighten the security of our templates by default to allow only thing in our same origin and from the sources that we include by default in our template.

This gives us a bunch of benefits.
* Better CSRF protection
* Better XSS protection
* Better HTTPS support with upgrade-insecure-requests (which helps with integrity and confidentiality) and helps our users avoid mixed content and get the green padlock in the address bar.

It's pretty visible for our users so they can change it in one place.
* If we add a `@section`, the policy can be overridden by a specific page.

/cc @blowdart

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.