From 4c366e0110202d8cb6dd544007764a4a49260ccb Mon Sep 17 00:00:00 2001 From: Muffin Date: Wed, 17 Jul 2024 14:27:33 -0500 Subject: [PATCH] Use a fixed modification date when zipping --- src/virtual-machine.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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; }