bytecodealliance / bytecodealliance/wasmtime

WASIp3 HTTP request path-and-query is more lenient than RFC 3986

Open
#11,779 6 comments 0 reactions 0 assignees View on GitHub
bug wasi:impl
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 19h
Merged PRs (30d)
121

Description

According to [RFC 3986 §3.3](https://www.rfc-editor.org/rfc/rfc3986#section-3.3), the following predicate should define the valid characters in a path component (besides the `/` and `?` delimiters):

```rust
fn is_valid_path_char(ch: char) -> bool {
// pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
ch.is_ascii_alphanumeric() || "-._~".contains(ch) // unreserved
|| ch == '%' // pct-encoded
|| "!$&'()*+,;=".contains(ch) // sub-delims
|| ":@".contains(ch)
}
```

However, the following paths are accepted via `request.set_path_and_query`:
* `/"`
* `/{`
* `/|`
* `/}`
* `/^`
* `/[`
* `/]`
* `/\`
* `/#`

What should change here, the spec or Wasmtime?

Relatedly, Wasmtime accepts non-absolute paths, which I am not sure are valid; https://github.com/WebAssembly/WASI/issues/791#issuecomment-3359974132.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.