Closed
Description
As part of the July 11 2017 security release we disabled V8 snapshots to mitigate hash flooding attacks against Node servers. The problem is that the snapshot is built at build time – and whatever the hash seed got used at that time gets baked into that particular Node.js binary.
Disabling snapshots has some negative performance & memory footprint consequences for code that heavily relies on creating lots of V8 contexts (e.g. via vm.runInNewContext
). Startup time might also be negatively affected (although this should not be substantial).
This issue is for discussing a way to getting V8 snapshots enabled back again. There are some alternatives that have been proposed:
- When the snapshot is deserialized, generate a new hash seed and then rehash all hash tables in the snapshot (including all dictionary mode objects).
- Hook into the Node.js install or startup process to periodically 'refresh' the snapshot blob on disk. This has ergonomic issues – requires modification of installers, and it may not be possible to write to disk in all environments.
- Generate a new snapshot on each startup and re-use it for future contexts. This will help address performance of
vm.runInNewContext
but will not help with the default startup time. - Modify the V8 object model so that each hash table has its own seed. This will have performance consequences even for code that doesn't need multiple contexts.
/cc @nodejs/v8 @nodejs/ctc