server
server copied to clipboard
[BUG]: API doesn't return proper error when API is disabled
Version Information
master
Hashcat
No response
Description
When API is disabled, it simplies run the following code:
File apiv2/index.php:
$enabled = getenv('HASHTOPOLIS_APIV2_ENABLE');
if (!$enabled || $enabled == 'false') {
die("APIv2 is not enabled, it can be enabled via environment variable!");
}
The UI cannot react to this, because it will cause all kinds of CORS errors.
THis makes it inpossible to access the data. The response should be a properly constructed HTTP response with CORS headers enabled.
Suggestion by @zyronix: If the API isn't enabled, CORS and things like that won't be done. By fixing the error so that it simply runs through the SLIM framework you can fix this and @xbenyx can just access the error message. @xbenyx can't do that now because the browser does not give access to the response of the API because an API error is given.