-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasmer_wasi: Unable to set env values containing = (equal sign) #1708
Comments
Hello, Thanks for the bug report. I believe this might be a constraint from the specification itself. It is true however that having an equal sign inside the value part kind of make sense. I would be personally willing to authorize this. Thoughts @MarkMcCaskey? |
That makes sense for me, probably we should allow |
Having `a=b` means that the environment variable key is `a`, and its value is `b`. Having `a=b=c` means that the key is `a` and its value is `b=c`. It's OK to get this, e.g. within a CGI context where values can hold strings such as `sec-ch-ua: "Chromium;v=86"` etc. See wasmerio#1708 for a longer explanation.
Works for me. Of course, |
Discussion continues at #1762. |
1762: fix(wasi) Allow the `=` sign in the environment variable value. r=Hywan a=Hywan # Description Having `a=b` means that the environment variable key is `a`, and its value is `b`. Having `a=b=c` means that the key is `a` and its value is `b=c`. It's OK to get this, e.g. within a CGI context where values can hold strings such as `sec-ch-ua: "Chromium;v=86"` etc. See #1708 for a longer explanation. # Review - [x] Add a short description of the the change to the CHANGELOG.md file Fixes #1708. Co-authored-by: Ivan Enderlin <[email protected]>
1762: fix(wasi) Allow the `=` sign in the environment variable value. r=Hywan a=Hywan # Description Having `a=b` means that the environment variable key is `a`, and its value is `b`. Having `a=b=c` means that the key is `a` and its value is `b=c`. It's OK to get this, e.g. within a CGI context where values can hold strings such as `sec-ch-ua: "Chromium;v=86"` etc. See #1708 for a longer explanation. # Review - [x] Add a short description of the the change to the CHANGELOG.md file Fixes #1708. Co-authored-by: Ivan Enderlin <[email protected]>
Problem
I was trying to run CGI apps using
wasmer-wasi
. You need to pass the client headers to the CGI app using environment variables, but some client headers contain equal signs (e.gsec-ch-ua: "Chromium";v="86", "\"Not\\A;Brand";v="99", "Google Chrome";v="86"
), which are rejected bywasmer-wasi
, but work fine usingwasmtime_wasi
.Bug
Setting a environment variable to a value containing an equal sign (=) is rejected by
WasiStateBuilder::build
, even though only keys may not contain equal signs. The first equal sign seperates the key from the value. Any other equal signs should be treated as part of the value.Fix
Removing the incorrect check for multiple equal signs:
It might make sense to add a check for equal signs in the key in the function
WasiStateBuilder::env
, so thatWasiStateBuilder::build
can return an error in such cases.Sample wasm app
Output using wasmtime:
Output using wasmer:
The text was updated successfully, but these errors were encountered: