mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
add testing for complex path sanitizer in ZipSlip
This commit is contained in:
@@ -15,3 +15,17 @@ fs.createReadStream('archive.zip')
|
||||
|
||||
fs.createWriteStream(path.join(cwd, path.join('/', fileName)));
|
||||
});
|
||||
|
||||
fs.createReadStream('archive.zip')
|
||||
.pipe(unzip.Parse())
|
||||
.on('entry', entry => {
|
||||
const fileName = path.normalize(entry.path);
|
||||
|
||||
if (path.isAbsolute(fileName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fileName.startsWith(".")) {
|
||||
entry.pipe(fs.createWriteStream(fileName)); // OK.
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user