crypto-bug-hunters / bug-buster

🪲 Bug Buster, a bug bounty platform powered by Cartesi Rollups
https://x.com/BugBusterApp
Apache License 2.0
10 stars 10 forks source link

Enhance exception handling when testing an exploit code #120

Open claudioantonio opened 1 month ago

claudioantonio commented 1 month ago

Context

Due to #119 it would be important to handle the exception when there is an error on the inspect call associated to the test exploit code feature. The expected result is to receive an Json, but when there is an error we receive a string then the app show the truncated message. Unexpected token 'F', "Failed to "... is not valid JSON

Expected behavior

Check the result and present the full message, which in the case of #119 the message was: Failed to inspect state: session is tainted

guidanoli commented 1 month ago

I think the inspect call indeed returned a JSON as expected, and that this message was, as expected, encoded through reports. You can see on the front-end code that it only writes to the shell component (through setExploitOutput) after processing the response body as a JSON.

https://github.com/crypto-bug-hunters/bug-buster/blob/89ab74c05d5da0b5c78c85d5e8a0ffc51c836deb/frontend/src/app/bounty/%5BbountyId%5D/exploit/page.tsx#L101-L109