LiquidAI-project / wasmiot-supervisor

Device supervisor to manage deployment of WebAssembly modules. Works together with wasmiot-orchestrator.
MIT License
0 stars 1 forks source link

User input validation for running deployed modules #2

Open heikkilv opened 1 year ago

heikkilv commented 1 year ago

There should be some kind of validation for the user input when accessing the /modules/<module_name>/<function_name> endpoint.

Currently if the input parameters are not correct types (or convertable to them), the app either crashes or becomes unresponsive. For example, trying the fibonacci function with input 5.5 does not return anything and the app must be restarted.

Similar validation would likely be required for the other endpoints that access the deployed Wasm modules.

pyjopeko commented 1 year ago

Need to try pydantic to do this.

heikkilv commented 1 year ago

Pydantic could be used to check the Python types before calling the wasm module, and would be enough for most cases.

Some additional checks would likely be needed to handle for example the fact that Python has only one integer type with arbitrary precision, while the wasm function likely would take either 32-bit or 64-bit integers.