-
Notifications
You must be signed in to change notification settings - Fork 24
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
Sec-
prefix for a server header
#59
Comments
@arnar Suggested this. Headers go both way here, so there are are headers sent were we want this kind of protection. We also want this protection for response headers to make sure JS cannot alter them to protect from among others reply attacks. |
That makes sense for the request headers, but I'm not convinced that the response headers should mirror that prefix.
I don't think |
https://datatracker.ietf.org/doc/html/rfc8942#:~:text=the%20Sec%2D%20prefix,%C2%B6
|
That's true for request headers but not for response headers. |
The Fetch spec indeed only uses "sec-" to mark headers as forbidden request headers, and the only forbidden response headers are Set-Cookie and Set-Cookie2. Forbidden response headers are filtered from JS to see them, based on a set of rules that e.g. include taking CORS into account. So @yoavweiss is correct in that "Sec-" does not do anything automatically for response headers, but the takeaway is whether we should think about if any of the response headers we are defined ought to be forbidden headers (e.g. hidden from XHR responses). |
Any progress on this? I agree with OP that using |
I have no strong opinion here, we put it in originally from a misunderstanding I think has been corrected in this discussion. @kristianmonsen I'm fine dropping "Sec-" from the response headers. |
I can change that, it's a bit of work so just checking here first if we agree on what would be better. My proposal is:
Would this work? |
The prefix "Sec-" was really serving two purposes, so that our headers aren't just "Session-..." -- since that term in isolation is already heavily overloaded. I know it sounds silly but I think we should have a common prefix for all the headers defined by this spec, and since "Sec-Session-" doesn't work, the next best option is "Secure-Session-" everywhere. That means the request headers would be "Sec-Secure-Session-..." 🙄 But silly as it is, that's IMO better than sometimes using "Secure-Session-" and other times "Sec-Session-". And it assigns no additional meaning to "Sec-", which is what I understand this issue to be about. |
So:
My preference would be to make them all Secure-Session-*, I am not sure if Sec- on request headers really changes anything practically for DBSC.. |
I think if it's exactly the same header using the same name is reasonable. Where in the Fetch processing model do these get set? What if a web developer has already set them? The former is important regardless, the latter is important if you don't use |
AFAIK, the purpose of the
Sec-
prefixed header is to provide some guarantees about browser-provided headers and prevent JS code from altering/overriding them. I don't think any of that applies to server provided headers.Is there any reason for the prefix?
The text was updated successfully, but these errors were encountered: