Access current URL in WASM (c/c++)

Viewed 581

I need to secure my C++ WebAssembly script for stealing and using on other domains than mine.

Is there some way how to access URL of current window in directly WASM script, where I can check it?

I could send domain as parameter from JS to WASM, but it could be easy overwritten there.

1 Answers

No, there is no way to access the current URL from a WebAssembly module without interoperating with the JavaScript host. In fact, WebAssembly cannot do anything without the host's help! It is design to have no I/O capabilities.

Furthermore, even if it could access the URL - it would still not be a very robust security model. It is very easy to decompile and modify a WebAssembly module. Any code you deploy to the web, regardless of the language you use, can be stolen!

Related