Skip to content

๐Ÿ›ก๏ธ Sentinel: [HIGH] ์‹ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ํ†ตํ•œ ๊ฒฝ๋กœ ํƒ์ƒ‰(Path Traversal) ์ทจ์•ฝ์  ์ˆ˜์ •#75

Open
seonghobae wants to merge 4 commits into
masterfrom
sentinel-symlink-fix-8279391723999576652
Open

๐Ÿ›ก๏ธ Sentinel: [HIGH] ์‹ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ํ†ตํ•œ ๊ฒฝ๋กœ ํƒ์ƒ‰(Path Traversal) ์ทจ์•ฝ์  ์ˆ˜์ •#75
seonghobae wants to merge 4 commits into
masterfrom
sentinel-symlink-fix-8279391723999576652

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

๐Ÿšจ 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

@google-labs-jules

Copy link
Copy Markdown

๐Ÿ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings July 1, 2026 03:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).canonicalFile with File(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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants