How It Works
Safely executing code, one request at a time
The Code Interpreter API lets you execute untrusted code in a few lines of code.
But how do we actually safely execute that code? Here’s a brief explanation of how it works.
Receive request
Your application makes a request to https://api.riza.io with the code to execute and any input data.
Validate data
We validate that the incoming code and data don’t violate resource limits.
Load WebAssembly
We load the compiled WebAssembly binary for the selected interpreter into memory. For most requests this step is cached.
Create WebAssembly module
We instantiate a new WebAssembly module for the loaded interpreter. We
set stdin
, command line arguments and environment variables, and
configure runtime resource limits.
Execute code
We execute the code from your request within the WebAssembly module.
Return response
We return stdout
and stderr
from the execution,
along with the program’s exit code.