metacall / faas

Reimplementation of MetaCall FaaS platform written in TypeScript.
https://dashboard.metacall.io
Apache License 2.0
13 stars 20 forks source link

server crash on illformatted metadata json #16

Closed durgesh077 closed 1 year ago

durgesh077 commented 1 year ago

The server crashes whenever incorrect format of jsons (metadata ) is given while calling with api. For e.g. if we send (notice not using proper double quote ) { language_id: "file", "path":".", scripts:[] }

expected behaviour:- reponse should be of Bad request

actual :- server crashing

extra:- it will throw error, because JSON.parse on Filefetch controller of api.ts doesn't have try catch

durgesh077 commented 1 year ago

Please assign me this issue.

Creatoon commented 1 year ago

Thanks for reporting this, the thing is we can fix this thing by JSON.stringify() before parsing it, so that It wont throw error, and the main thing to check is, if the json recieved by json can be fit in the type of MetacallJSON or not, if not we will simply respond back with incorrect metacall.json.