Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Ready for review Stale

93937[TASK] Let reaction itself verify request

Soren Malling CR 0 V 0 Normal +53 −10 updated 09/17/26, 15:12

Commit message

First draft to find a way to hopefully make this into the 14.3 branch

To allow for receiving request from more systems,
the hard requirement of the x-api-key is possible
to be overridden by a custom "verify" method.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 5
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/37/93937/5 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/37/93937/5 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Issues 1

Files 2

Review log 611

  1. Soren Malling uploaded patch set 1 05/03/26, 20:06

  2. core-ci voted on patch set 1 V -1 05/03/26, 20:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101439

  3. Toke Bundgaard uploaded patch set 2 V -1 05/05/26, 13:16

  4. core-ci voted on patch set 2 V -1 05/05/26, 13:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101555

  5. Soren Malling updated the commit message in patch set 3 V -1 05/06/26, 07:37

  6. core-ci voted on patch set 3 V -1 05/06/26, 07:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101598

  7. Toke Bundgaard uploaded patch set 4 V -1 05/06/26, 09:20

  8. core-ci voted on patch set 4 V +1 05/06/26, 09:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101605

  9. Toke Bundgaard updated the commit message in patch set 5 V +1 05/06/26, 10:30

  10. core-ci voted on patch set 5 V +1 05/06/26, 10:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101609

  11. Oli Bartsch commented on patch set 5 09/17/26, 15:12

    Unresolved

    Thank you for this patch. I really like the idea! Since this adds a public interface, it needs documentation, usually a feature rst but I would be fine with important here. Please also document the security implication noted above in it. Additionally, there is currently no test coverage for `ReactionResolver` at all, which is why the regression at line 72 went unnoticed. A functional test that builds a `ServerRequest` with a `routing` attribute (`RouteResult` with `_identifier => 'reaction'`) and calls `process()` directly covers the whole middleware cheaply. No HTTP stack needed. Worth adding for: unknown identifier, missing key, wrong key, valid key, unregistered reaction type, and both `verify()` outcomes.

    ReactionResolver.php:65 Unresolved

    The repository lookup now happens before any input validation. Previously `$secretKey === '' || !Uuid::isValid($reactionIdentifier)` short-circuited first, so a request with no `x-api-key` or a garbage identifier never reached the database. Every unauthenticated POST to `/typo3/reaction/<anything>` now runs a query.

    ReactionResolver.php:70 Unresolved

    `ReactionHandler::handleReaction()` resolves the very same reaction from the registry again. Either pass the resolved `$reaction` into the handler, or leave the resolution to the handler and only ask the registry here for the `VerifyRequestInterface` check. As it stands the handler's null branch is dead code.

    ReactionResolver.php:72 Unresolved

    This exception is thrown outside the `try`/`catch` at line 96, so nothing converts it into a response. Before this patch the same condition was reached inside `ReactionHandler::handleReaction()` (code `1662458842`) and caught. producing a clean JSON 404. Now a `sys_reaction` record whose `reaction_type` is no longer registered turns into a 500 exception. It is also thrown before any secret check, so an unauthenticated request can trigger it. Please return `$this->getFailureResponse('No reaction found for given reaction type', $request, 404)` instead, and only after verification has passed.

    ReactionResolver.php:76 Unresolved

    `verify()` receives only the request, not `$reactionInstruction`.

    ReactionResolver.php:81 Unresolved

    This `Uuid::isValid()` check can no longer fail in practice: the record was already fetched by this exact identifier at line 65, and `sys_reaction.identifier` always holds a UUID. It was a meaningful pre-filter in its old position; here it is a no-op. Move the validation back before the lookup.

    VerifyRequestInterface.php:22 Unresolved

    This interface is public API for extension authors but carries no docblock stating that, while the surrounding classes are all marked `@internal`. Please add a class docblock explaining when to implement it and what the security contract is: implementing it disables the `x-api-key` check entirely for that reaction type, so a `verify()` that returns `true` too eagerly opens the endpoint. That warning belongs both here and in the changelog.

    VerifyRequestInterface.php:22 Unresolved

    `VerifyRequestInterface` reads as an imperative. `RequestVerificationInterface` or `VerifiesRequestInterface` would sit better next to `ReactionInterface`.

    VerifyRequestInterface.php:27 Unresolved

    ```suggestion public function verify(ServerRequestInterface $request, ReactionInstruction $reaction): bool; ``` Without the instruction the interface cannot implement the scenario the issue describes.