Based on the proxy-wasm crate
The filter is ready to be built and verified with the enclosed docker-compose environment.
- clone this repo
rustup target add wasm32-unknown-unknown
, if needed for cross compilingcargo build --target=wasm32-unknown-unknown --release
docker-compose up --build
Each request directed to our service needs to be authorized by sending a token which is then checked for validity by the filter. If the token is validated - the request is passed on to the service. Otherwise - 403 response is returned to the caller. The validity check for the token is quite dumb - we check if the token is a prime number.
curl -H "token":"323232" 0.0.0.0:18000
Access forbidden.
curl -H "token":"32323" 0.0.0.0:18000
"Welcome to WASM land"
Read this blog post for more details on Envoy, WASM and Rust.