forked from oracle/opengrok
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
launder and quote yet more paths (oracle#4545)
- Loading branch information
Showing
3 changed files
with
16 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2017, 2019, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.util; | ||
|
@@ -139,7 +140,7 @@ public static String getRelativeToCanonical(Path path, Path canonical, | |
if (Objects.nonNull(allowedSymlinks) && Files.isSymbolicLink(iterPath) && | ||
!isWhitelisted(iterCanon.toString(), canonicalRoots) && | ||
!isAllowedSymlink(iterCanon, allowedSymlinks)) { | ||
String format = String.format("%1$s is prohibited symlink", iterPath); | ||
String format = String.format("'%1$s' is prohibited symlink", iterPath); | ||
LOGGER.finest(format); | ||
throw new ForbiddenSymlinkException(format); | ||
} | ||
|
@@ -180,8 +181,7 @@ private static boolean isAllowedSymlink(Path canonicalFile, | |
canonicalLink = fileSystem.getPath(allowedSymlink).toRealPath().toString(); | ||
} catch (IOException e) { | ||
if (LOGGER.isLoggable(Level.FINE)) { | ||
LOGGER.fine(String.format("unresolvable symlink: %s", | ||
allowedSymlink)); | ||
LOGGER.fine(String.format("unresolvable symlink: '%s'", allowedSymlink)); | ||
} | ||
continue; | ||
} | ||
|