Skip to content

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

@wingo

Description

@wingo

According to RFC 3986 §3.3, the following predicate should define the valid characters in a path component (besides the / and ? delimiters):

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; WebAssembly/wasi-http#178 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixingwasi:implIssues pertaining to WASI implementation in Wasmtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions