mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
add a trailing slash to the folder check in the QHelp for java/path-injection
This commit is contained in:
@@ -7,7 +7,7 @@ public void sendUserFileGood(Socket sock, String user) {
|
||||
Path filePath = publicFolder.resolve(filename).normalize().toAbsolutePath();
|
||||
|
||||
// GOOD: ensure that the path stays within the public folder
|
||||
if (!filePath.startsWith(publicFolder)) {
|
||||
if (!filePath.startsWith(publicFolder + File.separator)) {
|
||||
throw new IllegalArgumentException("Invalid filename");
|
||||
}
|
||||
BufferedReader fileReader = new BufferedReader(new FileReader(filePath.toString()));
|
||||
|
||||
Reference in New Issue
Block a user