Skip to content

cramhead/proxy-wasm-rust

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prime Authorizer - an Example of Building an Envoy WASM Filter with Rust

Based on the proxy-wasm crate

The filter is ready to be built and verified with the enclosed docker-compose environment.

Building and running:

  1. clone this repo
  2. rustup target add wasm32-unknown-unknown, if needed for cross compiling
  3. cargo build --target=wasm32-unknown-unknown --release
  4. docker-compose up --build

What the Filter Does

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.

Testing it Works

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.

About

WASM filter for Envoy - an example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%