Skip to content

Commit ffde069

Browse files
committed
another idea for path sanitization
1 parent 80f120e commit ffde069

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/web/Laundromat.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ public static String launderRevision(String value) {
7373
/**
7474
* Sanitize {@code value} where it will be used in subsequent OpenGrok
7575
* (non-logging) processing. The value is assumed to represent a file path,
76-
* not necessarily existent.
77-
* @return {@code null} if null or else {@code value} with anything besides
78-
* alphanumeric or {@code :} characters removed.
76+
* not necessarily existent on the file system.
77+
* @return {@code null} if null or else {@code value} with path traversal
78+
* path components {@code /../} removed.
7979
*/
8080
public static String launderPath(String value) {
81-
return replaceAll(value, ESC_N_R_T_F, "");
81+
return replaceAll(value, "/../", "");
8282
}
8383

8484
/**

0 commit comments

Comments
 (0)