Review main Merged

96560[BUGFIX] Keep status with WWW-Authenticate header

Oli Bartsch CR +2 V +2 Normal +66 −1 updated 10/10/26, 07:40

Commit message

PHP sets the response status to 401 whenever a WWW-Authenticate header
is sent with header(), even when a different status line was sent
before. This is done by PHP's SAPI layer itself and is not mentioned in
the documentation of header(). Sending

  header('HTTP/1.1 403 Forbidden');
  header('WWW-Authenticate: Bearer error="insufficient_scope"');

therefore answers with "401 Unauthorized".

As AbstractApplication::sendResponse() sends the status line before
the headers, a PSR-7 response with status 400 or 403 and a
WWW-Authenticate header, as RFC 6750 requires for "invalid_request"
and "insufficient_scope", reached the client as 401.

The status line of the response is now sent again after its headers
when a WWW-Authenticate header is present, so the status of the PSR-7
response is kept.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Josua Vogel +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Oliver Klee +1
    • Josua Vogel +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 67

  1. Oli Bartsch uploaded patch set 1 10/09/26, 12:07

  2. core-ci voted on patch set 1 V +1 10/09/26, 12:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110599

  3. Benni Mack voted on patch set 1 CR +1 V +1 10/09/26, 13:18

  4. Josua Vogel voted on patch set 1 CR +1 V +1 10/09/26, 13:25

  5. Oliver Klee voted on patch set 1 V +1 10/09/26, 14:13

  6. Oli Bartsch voted on patch set 1 CR +2 V +2 10/10/26, 07:40

  7. Oli Bartsch merged patch set 2 10/10/26, 07:40