I have personally run into a number of issues over the past few years dealing with wasi-crypto in-tree and I've gotten to the point that I would like to pose the question of whether we should remove it from this repository.
Support for wasi-crypto was added in early 2021 and it was updated later that year in October, but since then it has received no updates in-tree. There was an abandoned update from a year later which was followed up with a currently open PR which is blocked on vetting the dependency updates. In terms of vetting the dependency tree of wasi-crypto represents 1.5M lines of code to audit out of Wasmtime's total 5.5M lines to audit (minus v8). This is one of Wasmtime's heaviest dependencies at nearly 30% of the entire audit backlog (minus v8).
Currently wasi-crypto is behind both a compile-time Cargo feature gate (features = ["wasi-crypto"]) as well as a runtime feature gate (--wasi-modules=experimental-wasi-crypto). The wasi-crypto crate compiles for some CI platforms but does not compile for AArch64 platforms or MinGW for example. This is handled by our ci/run-tests.sh script explicitly skipping wasi-crypto tests.
I believe the original purpose for adding this to Wasmtime was to provide a testing ground for the APIs and enable users to more easily enable it and test with it. I'm not sure to what extent this has happened or to what degree the implementation here in Wasmtime has informed development of the upstream proposal. If others could help fill in info on this it'd be much appreciated.
One thing I have noticed poking around historically in wasi-crypto is that it noticeably contains an transmute of guest-owned memory into a &'static mut [u8] type. This does not appear to cause any issues today since it appears that function either always bottoms out in an error or it's stored into an Arc<Mutex<...>> but never read. Despite this though it at least personally worries me not only because it's very easy to get &'static mut T wrong but there are no comments indicating why this is done or what the purpose is (there are actually only 16 lines of comments in the 6kloc making up wasi-crypto and its hostcall implementation). Personally one concern I would have about this is that it seems much of the wasi-crypto code is largely un-reviewed and not necessarily up to the quality standards of the rest of Wasmtime.
Personally I'm also not actually sure if there are any maintainers of the wasi-crypto code in Wasmtime. I don't believe any of the typical active Wasmtime contributors consider themselves maintainers, but I would otherwise assume that @jedisct1 is the maintainer as he's been the source of the major contributions so far. I'm not sure if it's ever been made official though (not that we have a great place to officially document this), but @jedisct1 do you want to be the official maintainer of wasi-crypto in Wasmtime? I haven't been able to tell historical as I haven't heard back from you on other changes and the current issues with vetting haven't had much further discussion as well.
All that said, my current personal leaning is that these issues lead me to concluding we should remove wasi-crypto from the tree for now:
- So far there has not been an active maintainer for wasi-crypto. The wasi-crypto proposal had many updates in the past years but the support in Wasmtime has stagnated. It feels like the code was added to Wasmtime but then effectively left in largely the original state so I'm not sure how much testing/experience has been gained.
- Personally I have reservations about the code quality of the implementation (e.g. the
transmute above and lack of comments in general). I have not personally tested the code myself though or tried to run programs.
- The wasi-crypto crate brings in a very large tree of dependencies (1.5M+ lines of code) to audit, review, and ideally maintain. This makes it I think one of the larger of the WASI proposals, especially relative to the amount of review we're giving it.
I also don't want to jump to any conclusions though. If an active maintainer comes on, we get active review of existing and new code, and the dependency tree is perhaps slimmed down then I think it's reasonable to continue to keep wasi-crypto in-tree. I still think there's a huge amount of value in having something built-in for testing, and if users have been actively evaluating Wasmtime's support for wasi-crypto to help development of the upstream proposal that would be great to know.
I have personally run into a number of issues over the past few years dealing with wasi-crypto in-tree and I've gotten to the point that I would like to pose the question of whether we should remove it from this repository.
Support for wasi-crypto was added in early 2021 and it was updated later that year in October, but since then it has received no updates in-tree. There was an abandoned update from a year later which was followed up with a currently open PR which is blocked on vetting the dependency updates. In terms of vetting the dependency tree of
wasi-cryptorepresents 1.5M lines of code to audit out of Wasmtime's total 5.5M lines to audit (minus v8). This is one of Wasmtime's heaviest dependencies at nearly 30% of the entire audit backlog (minus v8).Currently wasi-crypto is behind both a compile-time Cargo feature gate (
features = ["wasi-crypto"]) as well as a runtime feature gate (--wasi-modules=experimental-wasi-crypto). Thewasi-cryptocrate compiles for some CI platforms but does not compile for AArch64 platforms or MinGW for example. This is handled by ourci/run-tests.shscript explicitly skippingwasi-cryptotests.I believe the original purpose for adding this to Wasmtime was to provide a testing ground for the APIs and enable users to more easily enable it and test with it. I'm not sure to what extent this has happened or to what degree the implementation here in Wasmtime has informed development of the upstream proposal. If others could help fill in info on this it'd be much appreciated.
One thing I have noticed poking around historically in wasi-crypto is that it noticeably contains an transmute of guest-owned memory into a
&'static mut [u8]type. This does not appear to cause any issues today since it appears that function either always bottoms out in an error or it's stored into anArc<Mutex<...>>but never read. Despite this though it at least personally worries me not only because it's very easy to get&'static mut Twrong but there are no comments indicating why this is done or what the purpose is (there are actually only 16 lines of comments in the 6kloc making up wasi-crypto and its hostcall implementation). Personally one concern I would have about this is that it seems much of the wasi-crypto code is largely un-reviewed and not necessarily up to the quality standards of the rest of Wasmtime.Personally I'm also not actually sure if there are any maintainers of the wasi-crypto code in Wasmtime. I don't believe any of the typical active Wasmtime contributors consider themselves maintainers, but I would otherwise assume that @jedisct1 is the maintainer as he's been the source of the major contributions so far. I'm not sure if it's ever been made official though (not that we have a great place to officially document this), but @jedisct1 do you want to be the official maintainer of wasi-crypto in Wasmtime? I haven't been able to tell historical as I haven't heard back from you on other changes and the current issues with vetting haven't had much further discussion as well.
All that said, my current personal leaning is that these issues lead me to concluding we should remove wasi-crypto from the tree for now:
transmuteabove and lack of comments in general). I have not personally tested the code myself though or tried to run programs.I also don't want to jump to any conclusions though. If an active maintainer comes on, we get active review of existing and new code, and the dependency tree is perhaps slimmed down then I think it's reasonable to continue to keep wasi-crypto in-tree. I still think there's a huge amount of value in having something built-in for testing, and if users have been actively evaluating Wasmtime's support for wasi-crypto to help development of the upstream proposal that would be great to know.