FrankChen021 opened a new pull request, #19813:
URL: https://github.com/apache/druid/pull/19813

   ## Summary
   
   - add a shared helper that resolves a relative path only when its normalized 
result remains beneath the intended directory
   - reject absolute paths, including absolute paths that happen to point 
beneath the configured directory
   - use the helper consistently for complete and partial segment info-file 
writes and deletion
   - cover legitimate nested paths, `..` traversal, absolute paths, and 
preservation of an out-of-directory sentinel
   
   ## Root cause
   
   `SegmentLocalCacheManager` constructed info-file paths directly from 
`DataSegment#getId()`. A segment identifier includes externally supplied 
data-source text, so a crafted identifier containing parent components could 
make the delete sink reported by CodeQL alert #7450 resolve outside the owned 
`info_dir`. The same construction was used by the corresponding info-file write 
paths.
   
   ## Fix and impact
   
   Segment info paths are now normalized and required to remain under the 
configured info directory before any file operation. Absolute paths are 
rejected explicitly. Normal relative paths, including legitimate nested 
relative paths, continue to resolve normally. This affects only invalid segment 
identifiers that would escape the configured info directory.
   
   ## Validation
   
   - `mvn -ntp -Pskip-static-checks -pl processing -DskipITs 
-Dtest=FileUtilsTest test` — 20 tests passed
   - `mvn -ntp -Pskip-static-checks -pl server -am -DskipITs 
-Dtest=SegmentLocalCacheManagerTest -Dsurefire.failIfNoSpecifiedTests=false 
test` — 31 tests passed
   - `mvn -ntp -pl processing,server -DskipTests validate` — Checkstyle, PMD, 
and Maven enforcer passed for both modules
   - `git diff --check`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to