summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnorthbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
index 3d32c7d74..8abefb719 100755
--- a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
+++ b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
@@ -333,6 +333,10 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite
while(zipEntry != null){
String fileName = zipEntry.getName();
File newFile = new File(DAEXIM_DIR + fileName);
+ // To remediate zip slip vulnerability, ensure file has the expected canonical path
+ if (!newFile.getCanonicalPath().startsWith(DAEXIM_DIR)) {
+ throw new IOException("Entry is outside of the target directory");
+ }
FileOutputStream fos = new FileOutputStream(newFile);
int len;
while ((len = zis.read(bytes)) > 0) {