Skip to content

Commit f76b892

Browse files
committed
dont use escaped value as array key
1 parent 6b9a389 commit f76b892

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

webroot/admin/user-mgmt.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class="filterSearch"
5656
);
5757
usort($user_attributes, fn ($a, $b) => strcmp($a["uid"][0], $b["uid"][0]));
5858
foreach ($user_attributes as $attributes) {
59-
$uid = htmlspecialchars($attributes["uid"][0]);
59+
$uid = $attributes["uid"][0];
60+
$uid_escaped = htmlspecialchars($uid);
6061
$gecos = htmlspecialchars($attributes["gecos"][0]);
6162
$org = htmlspecialchars($attributes["o"][0]);
6263
$mail_link = "mailto:" . urlencode($attributes["mail"][0]);
@@ -67,7 +68,7 @@ class="filterSearch"
6768
echo "<tr>";
6869
}
6970
echo "<td>$gecos</td>";
70-
echo "<td>$uid</td>";
71+
echo "<td>$uid_escaped</td>";
7172
echo "<td>$org</td>";
7273
echo "<td><a href='$mail_link'>$mail_display</a></td>";
7374
echo "<td>";
@@ -82,10 +83,10 @@ class="filterSearch"
8283
echo "<td>";
8384
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
8485
echo "<form class='viewAsUserForm' action='' method='POST'
85-
onsubmit='return confirm(\"Are you sure you want to switch to the user $uid?\");'>
86+
onsubmit='return confirm(\"Are you sure you want to switch to the user $uid_escaped?\");'>
8687
$CSRFTokenHiddenFormInput
8788
<input type='hidden' name='form_type' value='viewAsUser'>
88-
<input type='hidden' name='uid' value='$uid'>
89+
<input type='hidden' name='uid' value='$uid_escaped'>
8990
<input type='submit' name='action' value='Access'>
9091
</form>";
9192
echo "</td>";

0 commit comments

Comments
 (0)