|
38 | 38 | use In2code\Powermail\Utility\ObjectUtility; |
39 | 39 | use In2code\Powermail\Utility\SessionUtility; |
40 | 40 | use In2code\Powermail\Utility\TemplateUtility; |
| 41 | +use TYPO3\CMS\Core\Error\Http\BadRequestException; |
41 | 42 | use function in_array; |
42 | 43 | use Psr\EventDispatcher\EventDispatcherInterface; |
43 | 44 | use Psr\Http\Message\ResponseInterface; |
@@ -609,6 +610,17 @@ public function processRequest(RequestInterface $request): ResponseInterface |
609 | 610 | return parent::processRequest($request); |
610 | 611 | } catch (PropagateResponseException $e) { |
611 | 612 | return $e->getResponse(); |
| 613 | + } catch (BadRequestException $e) { |
| 614 | + if (in_array($e->getCode(), [1581862822, 1699604555, 1691267306])) { |
| 615 | + // If the trustedProperties HMAC can not be validated, we redirect to an empty form because the |
| 616 | + // request cannot be salvaged and would lead to an infinite loop. |
| 617 | + $logger = ObjectUtility::getLogger(__CLASS__); |
| 618 | + $logger->warning('Redirecting to empty form because HMAC validation failed.', [$e->getMessage()]); |
| 619 | + return $this->redirect('form'); |
| 620 | + } |
| 621 | + $logger = ObjectUtility::getLogger(__CLASS__); |
| 622 | + $logger->critical('An error occurred: ', [$e->getMessage()]); |
| 623 | + return (new ForwardResponse('form'))->withoutArguments(); |
612 | 624 | } catch (\Exception $e) { |
613 | 625 | $logger = ObjectUtility::getLogger(__CLASS__); |
614 | 626 | $logger->critical('An error occurred: ', [$e->getMessage()]); |
|
0 commit comments