Review main Abandoned

62332[WIP][TASK] Disable sending HTTP headers via Abstract User Auth

Benni Mack CR 0 V 0 Easy +12 −27 updated 02/20/20, 21:37

Commit message

One of TYPO3's "god classes" - AbstractUserAuth a.k.a. $GLOBALS[BE_USER] -
does a lot of things manipulating the state of a PHP script, e.g. sending out
headers when a valid session is available.

For Frontend Users (FrontendUserAuthentication) this option has been disabled
by default for some time. This was only used for session fixation of unauthenticated
sessions, previously known as  the "recs" feature, which was disabled for security reasons
some time ago. Authenticated frontend requests (e.g. logged in Frontend User) are already
handled by TSFE and the PSR-7 response since TYPO3 v9 properly.

Requests with a valid backend user - meaning: all authenticated TYPO3 Backend requests
and frontend requests with a valid typo_be_user cookie send "no cache" headers
in order to prevent any caches, directly after session retrievel via "header()".

PHP's "header" method is (like "setcookie") something that sends a header
directly to the client, which is irreversible. This makes it somewhat impossible
to do proper subrequests within one PHP process, as some headers *might*
have been sent already.

Luckily, PSR-7 is designed to add headers to a Response object,
which are already added in the "BackendUserAuthenticator" middleware.

The public property "sendNoCacheHeaders" within "AbstractUserAuthentication"
has been set to false and marked as deprecated, but can be activated again by
manually assigning this option via PHP, and throwing a deprecation message
when applied.

The protected methods "sendHttpHeaders" and "getHttpHeaders"
are marked as deprecated, but kept for backwards-compatibility reasons.

Any typical TYPO3 user, integrator or developer won't notice any difference
at all, however if there is a custom backend set up with a custom process, or
the middleware is disabled (because TYPO3 is preparing the PSR-7 response,
rather than in the middle of the process),

Once the other part related to security and authentication - "setcookie" - is
moved to Request handling, it is possible to call authenticated requests
via CLI, as all HTTP-related response handling has been overcome by
avoiding header() and setcookie() methods for Frontend and Backend requests.

Still Missing:
- RST file (Important, and Deprecation)
- Issue number

Review

  • Code review CR 0

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V 0

    Imported before Forger kept the single votes, the next import adds them.

Files 3