News for hackers. Stuff that matters.
Re:No cookie consent walls, scrolling isn’t consent, says EU... by austincheney on Wednesday May 06, 2020 @08:25PM (#23098196)
Continued use of cookies is evidence of just how incompetent web development practices are.

Cookies allow storage of 4kb data in a file per single origin policy domain. They are slow to access and require an archaic API. At one point this made sense because it’s all we had.

Local storage features an amazingly primitive API, stores 5mb per domain, and is dramatically faster to access. Local storage is achieved universal support since IE8. From a storage perspective localStorage is a complete and superior replacement for cookies.

The only remaining difference is that cookies are artifacts separate from the browser. They can be sent in a an HTTP response without either a unique HTTP request and without appending that data to another artifact, such as hidden text in an HTML file. localStorage does not have that as it is meant to be local and thus would require JavaScript to write data from an HTTP response into storage. One extra step.

In practical terms all that means is that cookies can be written by a server application by developers who lack basic understanding of browser technologies. In software we call this kind of incompetence ”accepted practice”, but other industries call it negligence. I suspect if end users sued individual developers by name every time they were harmed or violated by bad software there would be less negligence in the world.

Re:No cookie consent walls, scrolling isn’t consent, says EU... by STRML on Wednesday May 06, 2020 @08:31PM (#23098244)
It is not that simple. Cookies can have attributes such as "HTTPOnly" (don't allow access from JavaScript), "Secure" (only send on TLS-enabled sites), and expiry. While it may seem possible to replicate some of these with JavaScript, there are a few problems:

1. Not everybody has JS enabled (your content site shouldn't require it)

2. If using localStorage, users can write their own data. Depending on how you store data, this ranges from "not a problem at all" to "serious attack vector". At the least, it increases risk if an attacker gets XSS.

3. Data stored in localStorage can't be transmitted upon page load, it has to be transmitted after the initial load, once scripts have executed. For some things, this is fine, for e.g. auth, this is pretty bad.

They are different technologies: localStorage & sessionStorage are not a full replacement for cookies.

That said, tracking is rampant across the web and with it, cookies. Getting rid of them would make some of this harder - but not at all impossible - while breaking other legitimate flows.

Re:No cookie consent walls, scrolling isn’t consent, says EU... by austincheney on Wednesday May 06, 2020 @08:48PM (#23098359)
> Not everybody has JS enabled (your content site shouldn't require it)

It is just as true that not everybody has cookies enabled.

> If using localStorage, users can write their own data. Depending on how you store data, this ranges from "not a problem at all" to "serious attack vector". At the least, it increases risk if an attacker gets XSS.

Users can write their own cookies as well: document.cookie = "whatever"; Users should have control to access and edit the data they are storing on their own devices.

> for e.g. auth, this is pretty bad.

Any data that is embedded in dynamically written HTML is fully available upon page load, so you don't need cookies or any other storage mechanism to solve that problem. You only need a way to send the data in the HTTP response.

> They are different technologies: localStorage & sessionStorage are not a full replacement for cookies.

They are a full replacement unless you lack confidence writing the necessary mechanisms in JavaScript that are typically left to Spring MVC for Java developers on the server.

Re:No cookie consent walls, scrolling isn’t consent, says EU... by duqd_ on Wednesday May 06, 2020 @10:34PM (#23099077)
Name a localstorage auth mechanism on 1st request ?
Re:No cookie consent walls, scrolling isn’t consent, says EU... by austincheney on Wednesday May 06, 2020 @11:08PM (#23099274)
If you don’t already have a valid session cookie name a cookie solution to first request authentication.

With a local storage solution I would embed a session hash in some dynamically written HTML or a response header that is then stored in localStorage and then on every subsequent page request in the current HTTPS session send back that session hash prepended with a salt in the https request header. Then it’s always on initial page request but only after the session is established by the server.

Re:No cookie consent walls, scrolling isn’t consent, says EU... by Dylan16807 on Thursday May 07, 2020 @01:14AM (#23099940)
> "Secure" (only send on TLS-enabled sites)

localStorage treats http and https as separate sites.

Re:No cookie consent walls, scrolling isn’t consent, says EU... by johnchristopher on Wednesday May 06, 2020 @08:28PM (#23098219)
I don't think it matters if data is stored in cookies or local storage in the context of opt in and GDPR though.
Re:No cookie consent walls, scrolling isn’t consent, says EU... by austincheney on Wednesday May 06, 2020 @08:31PM (#23098240)
That may be true, but my comment is about any use of cookies regardless of the data they contain. It’s fully achieved technological obsolescence.