Location
File: ./src/main/java/org/flossware/commons/util/FileUtil.java
Line: 78
Description
The validatePathTraversal() method calls toRealPath() twice (lines 78-79), which performs filesystem I/O operations including symlink resolution. This can be expensive, especially on network filesystems or when called frequently.
Recommendation
If this method is called in a hot path, consider:
- Caching the real path results, or
- Using a less expensive validation method for initial checks (like
validateNoTraversalPatterns) before doing the expensive toRealPath() calls
Severity
HIGH (performance impact in critical I/O paths)
Related
Distinct from #137 (which is about testing infrastructure). This is a specific performance issue in production code.
Location
File:
./src/main/java/org/flossware/commons/util/FileUtil.javaLine: 78
Description
The
validatePathTraversal()method callstoRealPath()twice (lines 78-79), which performs filesystem I/O operations including symlink resolution. This can be expensive, especially on network filesystems or when called frequently.Recommendation
If this method is called in a hot path, consider:
validateNoTraversalPatterns) before doing the expensivetoRealPath()callsSeverity
HIGH (performance impact in critical I/O paths)
Related
Distinct from #137 (which is about testing infrastructure). This is a specific performance issue in production code.