From 655254b8c364a985d73d76d57565f5228ca793b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nacho=20Cord=C3=B3n?= Date: Wed, 24 Jan 2024 12:01:01 +0000 Subject: [PATCH] [NOID] Fixes directory that should be non existing --- .../apoc/export/ExportCoreSecurityTest.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/core/src/test/java/apoc/export/ExportCoreSecurityTest.java b/core/src/test/java/apoc/export/ExportCoreSecurityTest.java index 9d61c7b6c..f1e8789db 100644 --- a/core/src/test/java/apoc/export/ExportCoreSecurityTest.java +++ b/core/src/test/java/apoc/export/ExportCoreSecurityTest.java @@ -174,14 +174,18 @@ public TestIllegalExternalFSAccess( not found. They all attempt to exit the import folder back to the apoc folder: Directory Layout: .../apoc/core/target/import */ - private static final String case10 = "file://%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f/apoc/" + FILENAME; - private static final String case11 = "file://../../../../apoc/" + FILENAME; - private static final String case12 = "file:///..//..//..//..//apoc//core//..//" + FILENAME; - private static final String case13 = "file:///..//..//..//..//apoc/" + FILENAME; - private static final String case14 = - "file://" + directory.getAbsolutePath() + "//..//..//..//..//apoc/" + FILENAME; - private static final String case15 = - "file:///%252e%252e%252f%252e%252e%252f%252e%252e%252f%252e%252e%252f/apoc/" + FILENAME; + private static final String nonExistingDirectory = "__non-existing-dir__"; + private static final String case10 = + "file://%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f/" + nonExistingDirectory + "/" + FILENAME; + private static final String case11 = String.format("file://../../../../%s/%s", nonExistingDirectory, FILENAME); + private static final String case12 = + String.format("file:///..//..//..//..//%s//core//..//%s", nonExistingDirectory, FILENAME); + private static final String case13 = + String.format("file:///..//..//..//..//%s/%s", nonExistingDirectory, FILENAME); + private static final String case14 = String.format( + "file://" + directory.getAbsolutePath() + "//..//..//..//..//%s/%s", nonExistingDirectory, FILENAME); + private static final String case15 = "file:///%252e%252e%252f%252e%252e%252f%252e%252e%252f%252e%252e%252f/" + + nonExistingDirectory + "/" + FILENAME; public static final List casesNotExistingDir = Arrays.asList(case10, case11, case12, case13, case14, case15);