We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d76206 commit 5a5192bCopy full SHA for 5a5192b
javascript/ql/test/query-tests/Security/CWE-022/ZipSlip/ZipSlipGood.js
@@ -15,3 +15,17 @@ fs.createReadStream('archive.zip')
15
16
fs.createWriteStream(path.join(cwd, path.join('/', fileName)));
17
});
18
+
19
+fs.createReadStream('archive.zip')
20
+ .pipe(unzip.Parse())
21
+ .on('entry', entry => {
22
+ const fileName = path.normalize(entry.path);
23
24
+ if (path.isAbsolute(fileName)) {
25
+ return;
26
+ }
27
28
+ if (!fileName.startsWith(".")) {
29
+ entry.pipe(fs.createWriteStream(fileName)); // OK.
30
31
+ });
0 commit comments