libraries/src/Input/Cookie.php
$secure Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client. When set to TRUE, the cookie will only be set if a secure connection exists. On the server-side, it's on the programmer to send this kind of cookie only on secure connection (e.g. with respect to $_SERVER["HTTPS"]).
$httpOnly When TRUE the cookie will be made accessible only through the HTTP protocol. This means that the cookie won't be accessible by scripting languages, such as JavaScript. This setting can effectively help to reduce identity theft through XSS attacks (although it is not supported by all browsers).
For both of these we set a value of false if it is not explicitly set as true. Shouldn't we always be setting this as true and be secure by default.
There may be a b/c issue with such a change but security fixes always beat b/c issues iirc
Labels |
Added:
No Code Attached Yet
|
pretty much every cookie, that is not security-related (like the session cookie is - that's why it has that flag set).
The session cookie has the same value as the CSRF which is widely available cookieValue = Joomla.getOptions('csrf.token')
(if a page has a properly instantiated a Form) which invalidates (in most cases) the argument. Ok, this is missing the expiry date and some other flags but still gives Devs the main part and they could recreate the cookie client side. In sort, I'm supporting the idea for a default true value.
My 2c
The session cookie has the same value as the CSRF
Nope. The CSRF token is a random token which is stored in the session, it does NOT have the same value.
The CSRF token is a random token which is stored in the session, it does NOT have the same value.
My bad, you're right.
Labels |
Added:
Feature
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-11-21 18:25:47 |
Closed_By | ⇒ | brianteeman |
closed due to lack of interest
I have sympathy for such a change. However, we have to be aware of the consequences:
With that in mind, I think that changing the default to true on https connection would be a sensible decision for 5.x /cc @laoneo
I'm against a default-true for that flag. There are plenty of valid uses cases to access cookies via JS - pretty much every cookie, that is not security-related (like the session cookie is - that's why it has that flag set). So, deliberately using that flag when necessary is the more sensible default