code-server/src/node
Asher a1d6bcb8e5
Handle cookies more robustly
If you visit /login/ instead of /login the cookie will be set at /login
instead of / which means the cookie can't be read at the root. It will
redirect to the login page which *can* read the cookie at /login and
redirect back resulting in an infinite loop.

The previous solution relied on setting the cookie at / (any invalid
value works) which then overrode the login page cookie since
parseCookies only kept a single value. So the login page would see the
same cookie the root was seeing and not redirect back. However, that
behavior depends on the cookies being in the right order which I'm not
sure is guaranteed.

This new method tests all available cookies and always sets the cookie
so the root path will be able to read it in case the login page is
seeing a cookie the root can't.

It also goes a step further and explicitly sets the path on the cookie
which fixes the case where there is a permanent misconfiguration
redirecting /login to /login/. Otherwise the cookie would continually be
set on /login only and you'd have another loop. It also means you only
need to delete one cookie to log out.

Lastly add some properties to make the cookies a bit more secure.
2019-11-07 13:36:18 -06:00
..
channel.ts Update to 1.39.2 2019-10-18 18:20:02 -05:00
cli.ts Fix relaunching during an update 2019-11-01 10:51:23 -05:00
connection.ts Add support for running extensions in the browser 2019-10-04 18:14:19 -05:00
insights.ts Add support for running extensions in the browser 2019-10-04 18:14:19 -05:00
ipc.ts Fix relaunching during an update 2019-11-01 10:51:23 -05:00
marketplace.ts Update to 1.39.2 2019-10-18 18:20:02 -05:00
nls.ts Update to 1.39.2 2019-10-18 18:20:02 -05:00
protocol.ts Add support for running extensions in the browser 2019-10-04 18:14:19 -05:00
server.ts Handle cookies more robustly 2019-11-07 13:36:18 -06:00
update.ts Fix relaunching during an update 2019-11-01 10:51:23 -05:00
uriTransformer.js Fix outgoing scheme transformation 2019-10-30 10:32:57 -05:00
util.ts Enable password authentication by default 2019-10-24 12:35:26 -05:00