Create dedicated temporary dir for zip slip test
package com.google.refine.tests.importing;
+import java.io.File;
+import java.io.IOException;
import java.util.LinkedList;
import org.testng.Assert;
@@ -14,6 +16,7 @@ import com.google.refine.importers.tree.TreeImportingParserBase;
import com.google.refine.importing.ImportingJob;
import com.google.refine.importing.ImportingUtilities;
import com.google.refine.tests.importers.ImporterTest;
+import com.google.refine.tests.util.TestUtils;
import com.google.refine.util.JSONUtilities;
import com.google.refine.util.ParsingUtilities;
@@ -37,9 +40,10 @@ public class ImportingUtilitiesTests extends ImporterTest {
}
@Test(expectedExceptions=IllegalArgumentException.class)
- public void testZipSlip() {
+ public void testZipSlip() throws IOException {
+ File tempDir = TestUtils.createTempDirectory("openrefine-zip-slip-test");
// For CVE-2018-19859, issue #1840
- ImportingUtilities.allocateFile(workspaceDir, "../../script.sh");
+ ImportingUtilities.allocateFile(tempDir, "../../tmp/script.sh");
}
private ObjectNode getNestedOptions(ImportingJob job, TreeImportingParserBase parser) {
