Skip to content

Commit

Permalink
ensure no XSS for username
Browse files Browse the repository at this point in the history
  • Loading branch information
DawoudIO committed Feb 3, 2025
1 parent 2fa1041 commit ed1d9aa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/session/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use ChurchCRM\Authentication\Requests\LocalUsernamePasswordRequest;
use ChurchCRM\dto\SystemURLs;
use ChurchCRM\Slim\Middleware\VersionMiddleware;
use ChurchCRM\Utils\InputUtils;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
Expand Down Expand Up @@ -80,8 +81,8 @@ function beginSession(Request $request, Response $response, array $args): Respon
$renderer = new PhpRenderer('templates/');

// Determine if appropriate to pre-fill the username field
$pageArgs['prefilledUserName'] = $request->getQueryParams()['username'] ??
$request->getServerParams()['username'] ??
$pageArgs['prefilledUserName'] = InputUtils::filterSanitizeString($request->getQueryParams()['username']) ??
InputUtils::filterSanitizeString($request->getServerParams()['username']) ??
'';

return $renderer->render($response, 'begin-session.php', $pageArgs);
Expand Down

0 comments on commit ed1d9aa

Please sign in to comment.