Improve isManagerOf() error handling to prevent possible security bug

master
Skylar Ittner 6 years ago
parent d749564a53
commit 112599d162

@ -90,10 +90,10 @@ function isManagerOf($m, $e) {
$resp = json_decode($response->getBody(), TRUE); $resp = json_decode($response->getBody(), TRUE);
if ($resp['status'] == "OK") { if ($resp['status'] == "OK") {
return $resp['managerof']; return $resp['managerof'] === true;
} else { } else {
// this shouldn't happen, but in case it does just fake it. // this shouldn't happen, but in case it does just fake it.
return ["name" => $u, "username" => $u, "uid" => $u]; return false;
} }
} }

@ -82,7 +82,7 @@ function sendError($error) {
. "<h1>A fatal application error has occurred.</h1>" . "<h1>A fatal application error has occurred.</h1>"
. "<i>(This isn't your fault.)</i>" . "<i>(This isn't your fault.)</i>"
. "<h2>Details:</h2>" . "<h2>Details:</h2>"
. "<p>". htmlspecialchars($error) . "</p>"); . "<p>" . htmlspecialchars($error) . "</p>");
} }
date_default_timezone_set(TIMEZONE); date_default_timezone_set(TIMEZONE);

Loading…
Cancel
Save