-
Notifications
You must be signed in to change notification settings - Fork 72
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
Feedback version 1, small changes to default #202
Comments
Thanks for the feedback @damienbod!
I totally understand the sentiment here, and it's an option I considered. In the end I decided against it because:
One thing I considered was logging a warning at runtime when you use the default headers without a more strict CSP. That gets quite tricky to do well though, especially with the new design where you can change things at runtime. Maybe a simple "solution" would be an analyzer that detects when you call
For the referrer, we're already adding In terms of COOP etc, I didn't add those mostly because they're not in the recommended OWASP headers for REST responses. Also, the OWASP recommendations about the headers say:
That said, that applies to other HTML-only headers they do recommend (like Referrer-Policy etc), as a defence in depth approach, so that seems like it may just be an oversight on their part? 🤔 In their HTTP recommendations, they suggest the following: .AddCrossOriginOpenerPolicy(builder => builder.SameOrigin())
.AddCrossOriginEmbedderPolicy(builder => builder.RequireCorp())
.AddCrossOriginResourcePolicy(builder => builder.SameSite()) // 👈 Note not SameOrigin() Do you have any thoughts on the same-site vs same-origin for CORP? 🤔 OWASP suggest the more lenient option, but given that these don't apply to APIs (in theory) I'm inclined to go with your suggestion. |
@andrewlock Sound good to me. I would prefer the SameOrigin() which is more strict, if you want to weaken the security header configuration, then this is an active choice. For the default APIs, I don't see any reason not for doing this. But I understand when you want to stay with the suggested OWASP recommendations. Greetings Damien |
Yeah, you're right, I agree, I can't see a reason for making this same-site for an API, thanks 👍 |
Fixed in #204 |
Hi @andrewlock I think it's great. I have two small changes I think would help.
I think the default UI headers should be removed because without a good CSP, the security is still very weak and gives a false sense of security.
https://github.com/andrewlock/NetEscapades.AspNetCore.SecurityHeaders/blob/main/src/NetEscapades.AspNetCore.SecurityHeaders/HeaderPolicyCollectionExtensions.cs#L40
I would like to add the following to the default API security headers:
I can make a PR if you think either of these ideas are good.
Greetings Damien
The text was updated successfully, but these errors were encountered: