-
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
Validate Module Artifacts (CLI + WASIX ModuleCache) #3693
Conversation
theduke
commented
Mar 20, 2023
- wasix: Use validation when loading serialized modules
- cli: Use validation when loading module artifacts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not solving the caching problem in the proper way.
We should be fixing this function:
https://github.com/wasmerio/wasmer/blob/master/lib/types/src/serialize.rs#L103-L118
To use: rkyv::check_archived_value
instead (note that you may need to enable the validation
feature in rkyv)
I think this #3695 is relevant here. |
f1fd9ca
to
33f3f2a
Compare
33f3f2a
to
d4c65d3
Compare
Important modifications: commit d4c65d3 (HEAD -> wasix-no-unsafe-archive, origin/wasix-no-unsafe-archive)
commit 6c7d172
|
Also enabled I think we want this on by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the dangerous_
prefix is too much. The _checked
/_unchecked
is enough I think (especialy since it was "unchecked" since the beggining...
58e34bb
to
88de5c2
Compare
I rather like the But I don't mind much either way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a better take. Rather than making deserialize
unsafe and deprecated, we will make deserialize
to call deserialize_checked
and deserialize_unchecked
as dangerous_deserialize_unchecked
. Thoughts @theduke ?
I don't think we want to change the behaviour of an existing funciton in a minor bump. I'll just revert the renames and we can tackle that for 4.0. |
076d350
to
484c002
Compare
Enable rkyv validation of serialized module artifacts. Required additions: * derive the required CheckBytes trait for all types * Add `_checked` variants of all the deserialization functions Also enables the `strict` feature of rkyv by default. This will ensure consistent archive binary layout across architectures and Rust compiler versions.
Prevents undefined behaviour when loading modules. This is a much saner/safer default option, since loading modules without validation can cause UB and segfaults.
This is quite the oposite as the "dangerous_" one now. I would have created But I'm fine with current version, is just that I'm unsure it's enough this time. |
484c002
to
03f6cad
Compare
Syrus didn't want to deprecate methods, and I think adding new methods without deprecating the old ones makes the API too confusing and messy. |
fine with me |
|
Yes, but |