Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion htdocs/install/include/install_tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@

<div class="text-end mt-4">
<button class="btn btn-lg btn-success" type="<?php echo !empty($pageHasForm) ? 'submit' : 'button'; ?>"
<?php if (empty($pageHasForm)): ?>onclick="location.href=<?php echo json_encode($wizard->pageURI('+1')); ?>"<?php endif; ?>>
<?php if (empty($pageHasForm)): ?>onclick="location.href='<?php echo $wizard->pageURI('+1'); ?>'"<?php endif; ?>>

Check failure on line 185 in htdocs/install/include/install_tpl.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change this code to not reflect unsanitized user-controlled data.

See more on https://sonarcloud.io/project/issues?id=XOOPS_XoopsCore25&issues=AZ0JdPjZkUufV0FpvPuy&open=AZ0JdPjZkUufV0FpvPuy&pullRequest=1668
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new onclick builds a JavaScript string using a raw $wizard->pageURI('+1') value without JS/HTML escaping. Since pageURI() incorporates $_SERVER['HTTP_HOST']/PHP_SELF (see installwizard::baseLocation()), a crafted Host header or unexpected characters (e.g. a single quote) could break out of the JS string and/or attribute and enable XSS. Prefer generating the URL as a proper JS string via json_encode(...) and avoid the quote-collision by switching the HTML attribute to single quotes (or otherwise escaping for both JS + HTML contexts).

Suggested change
<?php if (empty($pageHasForm)): ?>onclick="location.href='<?php echo $wizard->pageURI('+1'); ?>'"<?php endif; ?>>
<?php if (empty($pageHasForm)): ?>onclick='location.href=<?php echo json_encode($wizard->pageURI("+1")); ?>'<?php endif; ?>>

Copilot uses AI. Check for mistakes.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
<?php echo BUTTON_NEXT; ?> <i class="fa-solid fa-caret-right"></i>
</button>
</div>
Expand Down
Loading