I can contribute a draft PR for this if you like. Just mention me.
Might be worth reminding that JSON and URL encoding converter:
https://github.com/js-cookie/js-cookie#converters
obviously won't work if you use an external library to do the storage encryption/tamper-proofing. (Can't decode a properly encrypted string...)
In the security industry, we see a lot of cookie-related CSRF and XSS vulnerabilities due to people...
Secure , SameSite, and HttpOnly is (they are mostly not)Many people simply Ctrl + C. Secure coding is still not widely taught. So it would help if the README can show proper use. Like a comment that reminds them to run validate.js or something on results after Cookies.get('name'), etc. That way you can still keep the shippable + dependencies small, but still encourage best practice.
No huge explainer needed about HTTP headers. Can just link to a resource:
https://web.dev/samesite-cookies-explained/
Hi Courtney, in general it鈥榮 a good idea, but the readme imo shouldn鈥檛 be the place to educate people about security best practices, and I鈥榤 trying to keep it as dense as possible. The impression (from issues we get) I got is that people often do not read the readme/documentation and I鈥榤 afraid it won鈥檛 get better if we add more things to it.
We do try to maintain a useful wiki, how about adding to that?
Related: Chrome started to make SameSite: lax a default, might be worth to mention..
@courtneyaschwartz Not sure what you had in mind though.. after rereading this it might have been adding just a bit to the converters section?
@carhartl Yes, a reminder about the new requirements about SameSite: None and converters would be good. (Like your existing reminder about InternetGetCookie and domain...)
And... This README can't possibly completely cover all of security. :) I am only suggesting a minimal hint, like your comments:
Cookies.get('foo', { domain: 'sub.example.com' }) //domainwon't have any effect...!
10% of people never read anything. We can't help that... But they'll ask experts for help. Experts learn by reading. We can help _them_.
@courtneyaschwartz Cool! If you would like to send a PR with these improvements you have in mind that would be much appreciated.. thank you!
Sure, no problem. Probably tonight.
Most helpful comment
@carhartl Yes, a reminder about the new requirements about
SameSite: Noneand converters would be good. (Like your existing reminder aboutInternetGetCookieanddomain...)And... This README can't possibly completely cover all of security. :) I am only suggesting a minimal hint, like your comments:
10% of people never read anything. We can't help that... But they'll ask experts for help. Experts learn by reading. We can help _them_.