Skip to content

Commit

Permalink
Merge pull request #85 from CPS-IT/fix/harden-methods
Browse files Browse the repository at this point in the history
[BUGFIX] Harden security check for allowed HTTP methods
  • Loading branch information
eliashaeussler authored Jan 23, 2025
2 parents 7facf4b + b6343b8 commit a9e687b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Classes/Controller/MailqueueModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,7 @@ public function __construct(

public function __invoke(Message\ServerRequestInterface $request): Message\ResponseInterface
{
$this->assertAllowedHttpMethod($request, 'GET', 'POST');

$template = $this->moduleTemplateFactory->create($request);
$transport = $this->mailer->getTransport();
$page = $this->resolvePageIdFromRequest($request);
$sendId = $request->getQueryParams()['send'] ?? null;
$deleteId = $request->getQueryParams()['delete'] ?? null;

// Force redirect when page selector was used
if ($request->getMethod() === 'POST' && !isset($request->getQueryParams()['page'])) {
Expand All @@ -75,6 +69,13 @@ public function __invoke(Message\ServerRequestInterface $request): Message\Respo
);
}

$this->assertAllowedHttpMethod($request, 'GET');

$template = $this->moduleTemplateFactory->create($request);
$transport = $this->mailer->getTransport();
$sendId = $request->getQueryParams()['send'] ?? null;
$deleteId = $request->getQueryParams()['delete'] ?? null;

if ($transport instanceof Mail\Transport\QueueableTransport) {
$templateVariables = $this->resolveTemplateVariables($transport, $page, $sendId, $deleteId);
} else {
Expand Down

0 comments on commit a9e687b

Please sign in to comment.