Reputation: 2300
I am wondering if there is a way to restrict a c++ compiled wasm file to NOT be able to call any javascript from within the c++ code. The idea is to prove to the user that the c++ wasm compiled file is not calling any javascript methods from within c++ i.e. it is only taking the input that has been provided from javascript trough some linear memory input working on it an giving back some result, but during that process no call should be possible to java script from within the c++ code. i.e. to put the wasm in some kind of jail mode where the binary is not able to call any javascript AT ALL! This is important in cases where the wasm produces itself some binary output, and it is unknown what is in that output. Basically i want to make sure that the "add2Strings" method that is called on the webassembly is not doing something else except adding "String1+String2" and returning some ByteBuffer/vector that represent the result (String1+String2) and not something like "String1+String2+FingerprintString+emailAddress" which can later be send trough javascript over the network god knows where.
Upvotes: 1
Views: 108
Reputation: 4942
I am wondering if there is a way to restrict a c++ compiled wasm file to NOT be able to call any javascript from within the c++ code
This is already default WebAssembly behavior. It can't execute any JavaScript function that you don't explicitly pass to it in the imports object.
Upvotes: 1