server icon indicating copy to clipboard operation
server copied to clipboard

[BUG]: API doesn't return proper error when API is disabled

Open zyronix opened this issue 2 years ago • 1 comments

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.

image

THis makes it inpossible to access the data. The response should be a properly constructed HTTP response with CORS headers enabled.

zyronix avatar Sep 07 '23 13:09 zyronix

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.

rixvet avatar Sep 19 '23 10:09 rixvet