Skip to content

Add allow list for HTTP methods/schemes/authorities#6401

Closed
brendandburns wants to merge 3 commits intobytecodealliance:mainfrom
brendandburns:allowed
Closed

Add allow list for HTTP methods/schemes/authorities#6401
brendandburns wants to merge 3 commits intobytecodealliance:mainfrom
brendandburns:allowed

Conversation

@brendandburns
Copy link
Contributor

This adds allow lists to HTTP which enable the creator of the wasm runtime to specify:

  • allowed methods
  • allowed schemes
  • allowed authorities

It also supports a wildcard value * which matches everything.

Unit tests to validate the functionality are also included.

@brendandburns brendandburns requested a review from a team as a code owner May 17, 2023 19:48
@brendandburns brendandburns requested review from alexcrichton and removed request for a team May 17, 2023 19:48
@brendandburns
Copy link
Contributor Author

cc @pchickey

@alexcrichton
Copy link
Member

I'm gonna move review over to @pchickey who's more in-depth with this stuff than I am, but it also looks like there's a CI failure you may be interested in.

@alexcrichton alexcrichton requested review from pchickey and removed request for alexcrichton May 17, 2023 22:14
@brendandburns brendandburns changed the title Allowed Add allow list for HTTP methods/sechemes/authorities May 17, 2023
@brendandburns
Copy link
Contributor Author

I'll look into the CI failure. "It worked on my machine"(tm)

@brendandburns
Copy link
Contributor Author

Ok, looks like this was incomptable with the changes in #6385 and I forgot to re-run the tests after a rebase.

CI should now pass, ready for a real review.

@brendandburns brendandburns changed the title Add allow list for HTTP methods/sechemes/authorities Add allow list for HTTP methods/schemes/authorities May 18, 2023

fn is_allowed(allow_list: &Vec<String>, value: String) -> bool {
for allowed in allow_list.iter() {
if allowed == "*" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to follow the convention in wasi-experimental-http that uses "insecure:allow-all" to match everything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will leave wild-card in for now. I'm not sure we want to imply wild-card == insecure, that seems to be up to the user of wasmtime to determine what is secure or not in their environment. (or we should define this in the wasi-http spec)

@brendandburns
Copy link
Contributor Author

Given discussion here:
#6808

Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants