Skip to content

Commit a0d67b7

Browse files
committed
Fix for GHSL-2022-008 vulnerability.
1 parent 657c2a7 commit a0d67b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/owasp/esapi/reference/DefaultValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public String getValidDirectoryPath(String context, String input, File parent, b
466466
if ( !parent.isDirectory() ) {
467467
throw new ValidationException( context + ": Invalid directory name", "Invalid directory, specified parent is not a directory: context=" + context + ", input=" + input + ", parent=" + parent );
468468
}
469-
if ( !dir.getCanonicalPath().startsWith(parent.getCanonicalPath() ) ) {
469+
if ( !dir.getCanonicalFile().toPath().startsWith( parent.getCanonicalFile().toPath() ) ) { // Fixes GHSL-2022-008
470470
throw new ValidationException( context + ": Invalid directory name", "Invalid directory, not inside specified parent: context=" + context + ", input=" + input + ", parent=" + parent );
471471
}
472472

0 commit comments

Comments
 (0)