fix: improve logging messages for zip security errors (#750)(PR #1698)

Logging error messages on invalid file-names or path traversal attacks improved
This commit is contained in:
Jan S
2022-10-06 20:31:42 +02:00
committed by GitHub
parent 711419a797
commit 8a45602ae6
2 changed files with 3 additions and 3 deletions
@@ -49,7 +49,7 @@ public class ResourcesSaver implements Runnable {
private void save(ResContainer rc, File outDir) {
File outFile = new File(outDir, rc.getFileName());
if (!ZipSecurity.isInSubDirectory(outDir, outFile)) {
LOG.error("Path traversal attack detected, invalid resource name: {}", outFile.getPath());
LOG.error("Invalid resource name or path traversal attack detected: {}", outFile.getPath());
return;
}
saveToFile(rc, outFile);
@@ -53,10 +53,10 @@ public class ZipSecurity {
if (isInSubDirectoryInternal(currentPath, canonical)) {
return true;
}
LOG.error("Path traversal attack detected, invalid name: {}", entryName);
LOG.error("Invalid file name or path traversal attack detected: {}", entryName);
return false;
} catch (Exception e) {
LOG.error("Path traversal attack detected, invalid name: {}", entryName);
LOG.error("Invalid file name or path traversal attack detected: {}", entryName);
return false;
}
}