mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Prevent zip path exploits
This commit is contained in:
@@ -294,8 +294,9 @@ impl BundleInfo<'_> {
|
||||
let mut archive = self.zip.borrow_mut();
|
||||
for i in 0..archive.len() {
|
||||
let file = archive.by_index(i)?;
|
||||
let key = file.name();
|
||||
files.push(key.to_string());
|
||||
let key = file.enclosed_name().ok_or_else(
|
||||
|| anyhow!("Could not extract file safely ({}). Ensure no paths in archive are absolute or point to a path outside the archive.", file.name()))?;
|
||||
files.push(key.to_string_lossy().to_string());
|
||||
}
|
||||
Ok(files)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user