๐ก๏ธ Sentinel: [๋ณด์ ๊ฐ์ ] ์ ๋ ฅ ๊ฒฝ๋ก ๊ธธ์ด๋ฅผ ์ ํํ์ฌ DoS ๋ฐ OOM ๋ฐฉ์ง - #608
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. |
|
Warning Review limit reachedNext included review available in 7 minutes. View limit detailsLimit details: Youโve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: โ๏ธ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: ๐ Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Noema LLM review
The PR adds a 4096-character length guard at the start of go() to mitigate DoS/OOM via oversized topDir inputs. The check is placed before any file-system access, includes a boundary-appropriate comparison, and is covered by a new test for 4097-character paths. No regressions were observed for normal-length paths.
Reviewed changed lines
src/main/kotlin/html4tree/main.kt:138 (RIGHT): The require(topDir.length <= 4096) guard runs before isNotBlank, traversal checks, File construction, and Files.isDirectory. This correctly blocks oversized inputs at the earliest point and prevents resource-intensive operations.src/test/kotlin/html4tree/MainTest.kt:130 (RIGHT): The new test constructs a 4097-character path and asserts IllegalArgumentException, matching the intended behavior. It may reach other guards after the length check, but the failure still validates the new security control..jules/sentinel.md:102 (RIGHT): The sentinel note correctly documents the vulnerability, learning, and prevention guidance for bounded input length before expensive file-system operations.
Adversarial validation
src/main/kotlin/html4tree/main.kt:138 (RIGHT)falsified: A path of exactly 4096 characters is rejected by the new length check. โ The comparison uses <=, so exactly 4096 characters passes. Subsequent validation proceeds normally.src/main/kotlin/html4tree/main.kt:138 (RIGHT)falsified: A path of 4097 characters reaches file-system operations before being rejected. โ The new require statement is the first line in go() and throws IllegalArgumentException immediately, before any file-system access.src/main/kotlin/html4tree/main.kt:138 (RIGHT)falsified: The new guard breaks previously accepted normal-length paths. โ The check only rejects inputs longer than 4096 characters; normal short paths remain unaffected.- Residual risk: No concrete regression hypothesis was falsified by the probes; the length check is placed before all file-system calls and is covered by a boundary test.
Findings
- No blocking findings.
- Result: APPROVE
- Head SHA:
48d3d2d7e745146d285f21f894ca409ef610a941 - Reviewer credential:
noema-review-github-app-refresh - Actor:
cwl-noema-review[bot]
์ด PR์ ์ ํจ ๋ณด์ delta๊ฐ ์์ด ๋ณํฉํ์ง ์๊ณ ์ข ๋ฃํฉ๋๋ค. ๋์ผํ 4,096-character cap ๊ฐ์ค์ canonical repair lane #598์์ realistic RED๋ก ๋ฐ์ฆํ๊ณ , portable filesystem contract๋ก ๊ต์ ํ์ต๋๋ค.
์ด branch์ ์ ์ฒด semantic delta๋ ์ธ ๊ฐ์ง๋ฟ์ ๋๋ค:
go()์require(topDir.length <= 4096)์ถ๊ฐ, 4,097์ ๋ฌธ์์ด์ดIllegalArgumentException์ ๋ด์ผ ํ๋ค๋ ํ ์คํธ, ๊ทธ๋ฆฌ๊ณ ์ด๋ฅผ MEDIUM DoS/OOM ๋ฐฉ์ด๋ผ๊ณ ์ผ๋ฐํํ Sentinel journal์ ๋๋ค. ์ด ์ ์ ๊ฐ์ ๊ฒ์ฆ๋์ง ์์ ์ ์ ๋ฅผ ๊ณต์ ํฉ๋๋ค.๋ฌธ์ ๋ Kotlin
String.length == 4097์์ฒด๊ฐ OOM/DoS ๊ฒฝ๊ณ๋ผ๋ ๊ทผ๊ฑฐ๊ฐ ์๊ณ , pathname ์ ์ฝ์ OS/filesystem๋ณ๋ก ๋ค๋ฅด๋ค๋ ์ ์ ๋๋ค. JavaFile์ pathname ๋ณํ์ system-dependent์ด๋ฉฐ POSIX/Windows pathname semantics๋ ๋์ผํ ๊ณ ์ 4,096-character ์ ํ๋ฆฌ์ผ์ด์ invariant๋ฅผ ์ ๊ณตํ์ง ์์ต๋๋ค. ๋ฐ๋ผ์ ์ด ๋ณ๊ฒฝ์ ์ ์ ์ ๋ ฅ์ ์์๋ก ๊ฑฐ๋ถํ ์ ์๊ณ ์ค์ resource-exhaustion ์์ธ(directory count/fan-out/generated bytes/filesystem calls/elapsed time/peak RSS)์ ๋ค๋ฃจ์ง ์์ต๋๋ค.Canonical repair #598์ current lineage๋ ๋ฐ๋ ๊ณ์ฝ์ ๋ช ์์ ์ผ๋ก ๊ณ ์ ํฉ๋๋ค: 4,097์๋ผ๋ ์ด์ ๋ง์ผ๋ก ๋ณ๋ path-length ์ค๋ฅ๋ฅผ ๋ด์ง ์์ผ๋ฉฐ, arbitrary 4,096 gate๋ฅผ ์ ๊ฑฐํ๊ณ , ์ค์ large-tree resource behavior๋ฅผ ๋ณ๋ product/technical Gap์ผ๋ก ์ถ์ ํฉ๋๋ค. #598 exact head
b18b1de3bf881ef51c863050ff5abf3b6df1625a๋ Draft์ด๊ณ exact-head CI/security๊ฐ ์์ง non-terminal์ด๋ฏ๋ก ๊ทธ๊ฒ ์ญ์ merge-ready๋ก ๊ฐ์ฃผํ์ง ์์ต๋๋ค.Primary references:
java.io.File: pathname string โ abstract pathname conversion is system-dependent โ https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/File.htmlpathconf()/PATH_MAX/NAME_MAX/ENAMETOOLONGsemantics โ https://man7.org/linux/man-pages/man3/fpathconf.3p.html๋ฐ๋ผ์ #608์๋ successor๋ก ์น๊ณํด์ผ ํ ๋ ๋ฆฝ์ ์ธ ์ ํจ test/fixture/contract๊ฐ ์์ต๋๋ค. false-positive security claim๊ณผ ๊ทธ claim๋ง ๊ฒ์ฆํ๋ source/test๋ฅผ ์ ๊ฑฐํ๋ ๊ฒ์ด ์ฌ๋ฐ๋ฅธ ์ฒ๋ฆฌ์ด๋ฉฐ, ์ค์ DoS/OOM ๋ฌธ์ ๋ #598์ ๊ธฐ๋ก๋ ์ธก์ ๊ฐ๋ฅํ resource-budget Gap์์ ๋ค๋ฃน๋๋ค.