-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add dir_perms
and file_perms
to WasiConfig.preopen_dir
#251
Comments
Thanks for the report! While this functionality is present in Rust it's not currently reflected in the C API which this package is built on. That doesn't mean it's not possible, just means that the sequence of steps to fix this would be to (a) update the C APi to enable plumbing these permissions bits and (b) update wasmtime-py to use the new bindings. If you're able to help that'd be much appreciated! If not however that's also ok too. |
The current `wasi_config_preopen_dir` function does not expose the `dir_perms` and `file_perms` parameters that were added to `preopened_dir`. This commit adds them and update the docs for those functions to reflect the current signature. This is a prerequisite for bytecodealliance/wasmtime-py#251
* Add permissions to `wasi_config_preopen_dir` C API The current `wasi_config_preopen_dir` function does not expose the `dir_perms` and `file_perms` parameters that were added to `preopened_dir`. This commit adds them and update the docs for those functions to reflect the current signature. This is a prerequisite for bytecodealliance/wasmtime-py#251 * Address review comments * Use early return for parameters
I'm also interested in this functionality. Looks like the next step is to update the version of wasmtime this package depends on, then update the preopen_dir python wrapper? @alexcrichton or @ajalt, are either of you already working on this first part, or would it be helpful for me to take it on this week? |
Thanks! I started working on the wasmtime 26 update as a first step, and ran into something I'm not sure how to handle. In particular for the bindings generation code the wasmparser::Validator type used to be exposed (because environ exposed |
Ah the |
For posterity, I am working on this, WIP here which we can land once wasmtime 27 is released. |
I just came looking for this feature myself. I want to be able to run the equivalent of this (but in Python): wget https://github.com/brettcannon/cpython-wasi-build/releases/download/v3.13.0/python-3.13.0-wasi_sdk-24.zip
unzip python-3.13.0-wasi_sdk-24.zip
wasmtime run --dir .::/ python.wasm -c 'print("hello world")' But I want the directory to be read-only, so that things like this don't break everything: wasmtime run --dir .::/ python.wasm -c 'open("python.wasm", "wb").write(b"blah")' |
@jder thanks for this! If you'd like feel free to go ahead and open a PR and update @simonw I believe that this issue will solve your need for that, and if you're interested in seeing such a readonly flag for Wasmtime mind opening an issue over there for that? I don't think we currently have an issue tracking that. |
Thanks! Posted that feature request here: |
The rust preopened_dir method has parameters for setting permissions to allow mapping the directory or its files as read-only. The python
preopen_dir
doesn't currently expose these parameters, so we can only map directories as read-write.Is it possible to add the ability to set permissions on mapped directories?
The text was updated successfully, but these errors were encountered: