File tree 1 file changed +7
-2
lines changed
google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/testing
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -404,8 +404,13 @@ private Path downloadEmulator() throws IOException {
404
404
log .fine ("Unzipping emulator" );
405
405
}
406
406
ZipEntry entry = zipIn .getNextEntry ();
407
- while (entry != null ) {
408
- File filePath = new File (emulatorPath .toFile (), entry .getName ());
407
+ while (entry != null ) {
408
+ File filePath = new File (emulatorFolder , entry .getName ());
409
+ String canonicalEmulatorFolderPath = emulatorFolder .getCanonicalPath ();
410
+ String canonicalFilePath = filePath .getCanonicalPath ();
411
+ if (!canonicalFilePath .startsWith (canonicalEmulatorFolderPath + File .separator )) {
412
+ throw new IllegalStateException ("Entry is outside of the target dir: " + entry .getName ());
413
+ }
409
414
if (!entry .isDirectory ()) {
410
415
extractFile (zipIn , filePath );
411
416
} else {
You can’t perform that action at this time.
0 commit comments