Skip to content

Commit

Permalink
restrict the maximum length of the X-Debug-Exception header
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jul 17, 2024
1 parent c25da5c commit 59ee876
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ErrorRenderer/HtmlErrorRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function render(\Throwable $exception): FlattenException
{
$headers = ['Content-Type' => 'text/html; charset='.$this->charset];
if (\is_bool($this->debug) ? $this->debug : ($this->debug)($exception)) {
$headers['X-Debug-Exception'] = rawurlencode($exception->getMessage());
$headers['X-Debug-Exception'] = rawurlencode(substr($exception->getMessage(), 0, 2000));
$headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
}

Expand Down
2 changes: 1 addition & 1 deletion ErrorRenderer/SerializerErrorRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function render(\Throwable $exception): FlattenException
$headers = ['Vary' => 'Accept'];
$debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($exception);
if ($debug) {
$headers['X-Debug-Exception'] = rawurlencode($exception->getMessage());
$headers['X-Debug-Exception'] = rawurlencode(substr($exception->getMessage(), 0, 2000));
$headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
}

Expand Down

0 comments on commit 59ee876

Please sign in to comment.