diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 09e9593353d..63872094c2c 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -527,6 +527,15 @@ class VirtualMachine extends EventEmitter { zip.file('project.json', projectJson); this._addFileDescsToZip(this.serializeAssets(), zip); + // Use a fixed modification date for the files in the zip instead of letting JSZip use the + // current time to avoid a very small metadata leak and make zipping deterministic. The magic + // number is from the first TurboWarp/scratch-vm commit after forking + // (4a93dab4fa3704ab7a1374b9794026b3330f3433). + const date = new Date(1591657163000); + for (const file of Object.values(zip.files)) { + file.date = date; + } + return zip; }