Skip to content

Commit

Permalink
Merge pull request #163 from fredrikstave/master
Browse files Browse the repository at this point in the history
Sanitize response message for unathorized headers
  • Loading branch information
Seldaek committed Apr 20, 2021
2 parents 765b62a + 80fc71a commit 0b964b6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion EventListener/CorsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ protected function getPreflightResponse(Request $request, array $options): Respo
continue;
}
if (!in_array($header, $options['allow_headers'], true)) {
$sanitizedMessage = htmlentities('Unauthorized header '.$header, ENT_QUOTES, 'UTF-8');
$response->setStatusCode(400);
$response->setContent('Unauthorized header '.$header);
$response->setContent($sanitizedMessage);
break;
}
}
Expand Down

0 comments on commit 0b964b6

Please sign in to comment.