๐ก๏ธ Sentinel: [HIGH] ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ํตํ ๊ฒฝ๋ก ํ์(Path Traversal) ์ทจ์ฝ์ ์์ #75
Conversation
|
๐ Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a ๐ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a high-severity symlink-based path traversal bypass in html4treeโs root directory validation by ensuring the provided topDir is normalized without resolving (and thereby following) symbolic links before applying NOFOLLOW_LINKS checks.
Changes:
- Replace
File(topDir).canonicalFilewithFile(topDir).absoluteFile.toPath().normalize().toFile()so symlinks are not implicitly resolved before validation. - Document the vulnerability cause and prevention guidance in
.jules/sentinel.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/main/kotlin/html4tree/main.kt |
Prevents canonicalFile from resolving symlinks before the NOFOLLOW_LINKS directory check, closing the bypass. |
.jules/sentinel.md |
Adds a Sentinel entry documenting the issue and the recommended prevention pattern. |
๐ก Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
๐จ Severity: HIGH
๐ก Vulnerability:
File.canonicalFile์ฌ์ฉ์ผ๋ก ์ธํด ์ดํFiles.isDirectory(..., LinkOption.NOFOLLOW_LINKS)๊ฒ์ฌ๊ฐ ์ฌ๋ณผ๋ฆญ ๋งํฌ ์๋ณธ์ด ์๋ ๋์ ๋๋ ํ ๋ฆฌ์ ๋ํด ์ํ๋์ด ์ฌ๋ณผ๋ฆญ ๋งํฌ ์ ํ์ด ์ฐํ๋๋ ๋ฌธ์ (Path Traversal)๐ฏ Impact: ํฌ๋กค๋ฌ๊ฐ ์๋ํ์ง ์์ ๋๋ ํ ๋ฆฌ ๋ฒ์๋ฅผ ๋ฒ์ด๋ ๋์ํ๊ฑฐ๋ ์์์ ์์น์
index.htmlํ์ผ์ ๋ฎ์ด์ธ ์ ์์๐ง Fix:
.canonicalFile๋์.absoluteFile.toPath().normalize().toFile()์ ์ฌ์ฉํ์ฌ ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ๋ฐ๋ผ๊ฐ์ง ์๊ณ ๋ ผ๋ฆฌ์ ์ผ๋ก ๊ฒฝ๋ก๋ฅผ ํด์ํ๋๋ก ์์ โ Verification:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 && ./gradlew test๋ฅผ ์คํํ์ฌ ๊ธฐ์กด์ ์คํจํ๋testGoRejectsSymlinkTopDirํ ์คํธ๊ฐ ์ฑ๊ณตํ๋์ง ํ์ธPR created automatically by Jules for task 8279391723999576652 started by @seonghobae