-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fiches MT en DSFR (ne pas merger) #1483
Conversation
|
||
rs.pipe(unzipper.Parse()) | ||
.on("entry", function (entry) { | ||
const filePath = entry.path.replace( |
Check failure
Code scanning / CodeQL
Arbitrary file access during archive extraction ("Zip Slip") High
file system operation
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that the entry.path
does not contain any directory traversal sequences like ..
before using it to construct outputPath
. This can be achieved by validating the filePath
and ensuring it is within the intended directory.
- We will add a check to ensure that
filePath
does not contain..
and is within theoutputDir
. - If the
filePath
is invalid, we will skip processing that entry and log a warning message. - This change will be made in the
downloadZip
function, specifically around the construction and usage ofoutputPath
.
-
Copy modified lines R98-R104 -
Copy modified lines R107-R112
@@ -97,4 +97,17 @@ | ||
|
||
// Validate filePath to prevent directory traversal | ||
if (filePath.includes("..")) { | ||
console.log('skipping bad path', filePath); | ||
entry.autodrain(); | ||
return; | ||
} | ||
|
||
const outputPath = path.join(outputDir, filePath); | ||
|
||
if (!outputPath.startsWith(outputDir)) { | ||
console.log('skipping bad path', filePath); | ||
entry.autodrain(); | ||
return; | ||
} | ||
|
||
if (entry.type === "Directory") { |
3cbb1a2
to
3f29399
Compare
Quality Gate passedIssues Measures |
🎉 Deployment for commit f318231 : Docker images
|
No description provided.