77946[TASK] Add HTTP security headers for backend by default
Commit message
Review
-
Code review CR +2 Done
- Georg Ringer +2
- Oliver Klee +1
- Christian Kuhn +1
- Oliver Hader +1
-
Verified V +2 Done
- Georg Ringer +2
- Christian Kuhn +1
- core-ci +1 CI
Issues 1
Files 3
Review log 1921
-
Torben Hansen uploaded patch set 1 02/25/23, 13:30
-
core-ci voted on patch set 1 V +1 02/25/23, 13:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38093
-
Sybille Peters commented on patch set 1 V +1 CR +1 02/25/23, 17:22
Personally, I would add that in the webserver configuration but I guess there is no harm if you can deactivate it and we have a stronger default this way. -
Oliver Klee voted on patch set 1 CR +1 02/25/23, 18:09
-
Josef Glatz voted on patch set 1 CR +1 02/27/23, 20:18
-
Christian Kuhn voted on patch set 1 V +1 CR +1 03/01/23, 12:27
-
Oli Bartsch commented on patch set 1 03/01/23, 12:58
AdditionalResponseHeaders.php:40Possible null pointer?AdditionalResponseHeaders.php:40Possible undefined array key? -
Christian Kuhn commented on patch set 1 03/01/23, 13:20
AdditionalResponseHeaders.php:40Replyi'd say we should rely on normalizedParams attribute being properly set by an earlier middleware. this should crash in case it has been tampered with.AdditionalResponseHeaders.php:40Replywell, it's defined in DefaultConfiguration.php. unsetting this property will probably raise further issues elsewhere and it should be fine to rely on it being set, imho. -
Christian Kuhn commented on patch set 1 V 0 CR 0 03/01/23, 13:39
not 100% sure about the hsts header by default, this is a thing you essentially can't ever get rid of again after a browser got it once. also, this is domain-wide, right? so if a FE is non-https as well, a BE user won't be able to call it http-only again? do we accept this force-browser-https as default? -
Christian Kuhn commented on patch set 1 03/01/23, 13:53
Reply
thinking about this some further, i tend to say that we shouldn't add the hsts header since this may be too intrusive by default, even in 2023 - we essentially "pollute" the entire domain as soon as the backend is https just once. i'd love to be convinced of the opposite, strong security defaults ... but maybe this is still a bit too much at the moment? an alternative is to send the hsts header only if 'isHttps()' AND 'lockSSL' = true? this would not kick in for default instances, though ... what do you think? -
Torben Hansen commented on patch set 1 03/01/23, 14:52
Reply
The patch will remove the HSTS header, if lockSSL is false AND if the website is not accessed using HTTPS. I think it may also be an option to on only set the HSTS header, if lockSSL is true. As soon as this requirement is reached, the backend is forced to use HTTPS and we can assume, that the website has a valid SSL certificate for that domain. For the scenario, that the backend must use HTTPS and the frontend HTTP, the website administrator can unset the HSTS header in `additional.php` manually. -
Torben Hansen commented on patch set 1 03/01/23, 15:09
Reply
State for other popular CMS: - WordPress: No HSTS header by default. - Drupal: No HSTS header by default. - Joomla: No HSTS header by default. Optional configurable (https://github.com/joomla/joomla-cms/blob/4.2-dev/plugins/system/httpheaders/httpheaders.php#L389) So maybe we should really only send the HSTS header for BE, if lockSSL=true -
Oliver Hader commented on patch set 1 03/01/23, 15:47
Reply
What would be valid use cases to use HTTPS only for the backend, but still rely on HTTP for the frontend? From my own experience, when a website was falling back to HTTP, it somehow was a server misconfiguration/error - which is one aspect, that HSTS is trying to mitigate. However, I'd be fine with the suggested combo with lockSSL as well for the basic default behavior. -
Torben Hansen uploaded patch set 2
CR +1V +103/01/23, 18:03 -
Torben Hansen commented on patch set 2 03/01/23, 18:05
Reply
The HSTS header is now only added, when `$GLOBALS[TYPO3_CONF_VARS][BE][lockSSL] = true` -
core-ci voted on patch set 2 V +1 03/01/23, 18:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38272
-
Christian Kuhn voted on patch set 2 V +1 CR +1 03/02/23, 07:49
-
Oliver Hader voted on patch set 2 CR +1 03/02/23, 07:52
-
Oliver Klee voted on patch set 2 CR +1 03/02/23, 09:44
-
Georg Ringer voted on patch set 2 V +2 CR +2 03/02/23, 11:23
-
Georg Ringer merged patch set 3 03/02/23, 11:23