go-safeweb icon indicating copy to clipboard operation
go-safeweb copied to clipboard

plugins/staticheaders: Add a `Vary: Cookie` header by default

Open empijei opened this issue 4 years ago • 5 comments

This is important for XSRF double-submit cookies and for other potential non-security related breakages.

Note: we cannot claim Vary but we should just add the value.

empijei avatar Jan 05 '21 09:01 empijei

MDN: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary.

I agree that for now we should add the value to the Vary header, but we might consider actually having a separate plugin to control Vary (or other headers like the ones for Cookies) and expose safe mutators.

kele avatar Feb 01 '21 17:02 kele

Vary should probably be treated in a append-only way, and we might want to even consider adding this to the framework rather than try to have a plugin that is shared across multiple plugins.

empijei avatar Feb 08 '21 08:02 empijei

The issue with having this in the core of the framework rather than a plugin is harder migration, because we usually don't offer opt-outs from core features. That being said, I'm not sure it's a big concern.

I'd be in favor of having a separate API for dealing with the Vary header, similarly to how we have a separate one for cookies.

kele avatar Feb 08 '21 10:02 kele

What is the alternative? Add a generic way to support append-only headers?

empijei avatar Feb 15 '21 15:02 empijei

EDIT: Nevermind, I misremembered what was in this thread.

Anyway, it seems that @empijei is in favor of adding it to the core of the framework too. Up for grabs. ;)

kele avatar Feb 15 '21 18:02 kele