You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve checks for relative paths in static resource handling #33689
Going forward with #33687 we are going to drop support for relative paths entirely. For the current 6.1.x branch, we can revise handling with the understanding that while the use case is still supported it is also likely not very common.
it seems the initial issue (path traversal via symlinks) was caused by the fact the FileSystemResource class does not keep in sync path, file and filePath fields:
public FileSystemResource(String path) {
Assert.notNull(path, "Path must not be null");
this.path = StringUtils.cleanPath(path);
this.file = new File(path); <---- should be new File(this.path)
this.filePath = this.file.toPath();
}
compare with:
public FileSystemResource(FileSystem fileSystem, String path) {
Assert.notNull(fileSystem, "FileSystem must not be null");
Assert.notNull(path, "Path must not be null");
this.path = StringUtils.cleanPath(path);
this.file = null;
this.filePath = fileSystem.getPath(this.path).normalize();
}
Activity
Normalize static resource path early
Update processPath for double encoding
Normalize static resource path early
Update processPath for double encoding
Normalize static resource path early
Update processPath for double encoding
Normalize static resource path early
Update processPath for double encoding
Normalize static resource path early
Update processPath for double encoding
andreybpanfilov commentedon Feb 10, 2025
@rstoyanchev
it seems the initial issue (path traversal via symlinks) was caused by the fact the
FileSystemResourceclass does not keep in syncpath,fileandfilePathfields:compare with:
CVE-2024-38819: complete the RouterFunctions path-traversal fix at 5.…