4 ms·
I can't imagine a situation when you don't trust getRandomValues, but trust touch/mouse inputs. If your getRandomValues is untrusted, why would you trust the wh
by dchest 5y ago
I can't imagine a situation when you don't trust getRandomValues, but trust touch/mouse inputs. If your getRandomValues is untrusted, why would you trust the whole JS runtime that implements it? If you think there's a Debian-like bug with the system PRNG, then you can't even trust the TLS connection that downloaded your JS code.
- speedgoose 5y agoI think it's possible that TLS is functional, but getRandomValues is hacked/broken. A popular browser extension sold or given away to a hacker could inject everywhere the following code for example: window.crypto.getRandomValues = (arrayBufferView) => arrayBufferView.fill(4); For sure using more entropy from JS will not do much in case of a targeted attack that did compromise the downloaded code or the runtime, but the scenario of a larger scale attack on WebCrypto is what I was thinking about.
- dchest 5y agoIf an extension can modify getRandomValues, then all your other code is also untrusted, you can't work around it by using other methods to generate randomness.
- speedgoose 5y agoI know. But the likelyhoood of a targeted attack on my code is much lower.