Handling cookies is a minefield
grayduck.mn
Handling cookies is a minefield
1–10 of 270 posts
Re: Handling cookies is a minefield
#2Re: Handling cookies is a minefield
#3Seems like every time I look at cookies they've grown a new wrinkle. They're just a nightmare to keep up with.
Re: Handling cookies is a minefield
#4If you are in complete control of front-end and back-end it's not a big problem, but as soon as you have to get different stuff to interoperate it gets very stupid very fast.
Re: Handling cookies is a minefield
#5 Firefox accepts five characters which RFC recommends that servers not send:
0x09 (horizontal tab)
0x20 (spaces)
0x22 (double quotes)
0x2C (commas)
0x5C (backslashes)
I agree with at least some of these. Cookies without commas? Quotes?Re: Handling cookies is a minefield
#6Re: Handling cookies is a minefield
#7The article mentions Rust's approach, but note that (unlike the other mentioned languages) Rust doesn't ship any cookie handling facilities in the standard library, so it's actually looking at the behavior of the third-party "cookie" crate (which includes the option to percent-encode as Ruby does): https://docs.rs/cookie/0.18.1/cookie/
Re: Handling cookies is a minefield
#8Firefox accepts five characters which RFC recommends that servers not send: 0x09 (horizontal tab) 0x20 (spaces) 0x22 (double quotes) 0x2C (commas) 0x5C (backslashes) I agree with at least some of these. Cookies without commas? Quotes?
Re: Handling cookies is a minefield
#9And the article isn't even about the proliferation of attributes cookies have, that browsers honor, and in some cases are just mandatory. I was trying to explain SameSite to a coworker, and scrolled down a bit... https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#co... wait, cookie prefixes ? What the heck are those? The draft appears to date to 2016, but I've been trying to write secure cookie code for longer…
https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#co...
> For more information about cookie prefixes and the current state of browser support, see the Prefixes section of the Set-Cookie reference article.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Se...
(Cookie prefixes have been widely supported since 2016 and more or less globally supported since 2019.)
They’re backwards-compatible, so if your cookie need meets the requirements for the `__Host-` prefix, you should use `__Host-`.
Re: Handling cookies is a minefield
#10The article mentions Rust's approach, but note that (unlike the other mentioned languages) Rust doesn't ship any cookie handling facilities in the standard library, so it's actually looking at the behavior of the third-party "cookie" crate (which includes the option to percent-encode as Ruby does): https://docs.rs/cookie/0.18.1/cookie/