This is a follow-up to GHSA-hgjw-h833-99q9 and #14044 which wasn't originally included in the fix for the advisory due to complexity needed. The idea though is that it might be reasonable to have a defensive assertion in Module::wasm_to_array_trampoline to assert that the engine which the VMSharedTypeIndex comes from is indeed the same engine as the Module itself.
@fitzgen one possible idea I just had from the original implementation you had was that we could perhaps store an "Engine ID" inside of a ModuleRegistry to avoid threading &Engine to a whole bunch of new places if that causes problems. That'd be easier than storing the entire engine itself in there.
This is a follow-up to GHSA-hgjw-h833-99q9 and #14044 which wasn't originally included in the fix for the advisory due to complexity needed. The idea though is that it might be reasonable to have a defensive assertion in
Module::wasm_to_array_trampolineto assert that the engine which theVMSharedTypeIndexcomes from is indeed the same engine as theModuleitself.@fitzgen one possible idea I just had from the original implementation you had was that we could perhaps store an "Engine ID" inside of a
ModuleRegistryto avoid threading&Engineto a whole bunch of new places if that causes problems. That'd be easier than storing the entire engine itself in there.