Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@
**Root cause:** The protected implementation added canonical names to the exclusion set but did not compare each observed directory entry through a locale-stable normalized key.
**Prevention:** Build one `Locale.ROOT` lowercase set from the canonical sensitive names, compare every observed name against it, and add the original spelling to the exclusion set so downstream exact membership remains correct.
**Evidence:** `testProcessIgnoreFileTreatsSensitiveNamesCaseInsensitively` failed on test-only commit `472b916cd40f70693c4e1eb48956042a25353feb` (CI run `31469596932`) and passed with the source fix at `bb113d858ccfc42ddaecf6729749b238e5ade2d0` (CI run `31469921661`).

## 2026-09-16 - [DoS/OOM ๋ฐฉ์ง€] ์ž…๋ ฅ ๊ฒฝ๋กœ ๊ธธ์ด ์ œํ•œ ๋ˆ„๋ฝ
**Vulnerability:** ํŒŒ์ผ ์‹œ์Šคํ…œ API์— ์ „๋‹ฌ๋˜๋Š” ์‚ฌ์šฉ์ž ์ œ๊ณต ๋””๋ ‰ํ† ๋ฆฌ ๊ฒฝ๋กœ ๋ฌธ์ž์—ด(`topDir`)์— ๋Œ€ํ•œ ์ตœ๋Œ€ ๊ธธ์ด ๊ฒ€์ฆ์ด ๋ˆ„๋ฝ๋˜์–ด ์•…์˜์ ์œผ๋กœ ๊ธด ๋ฌธ์ž์—ด ์ž…๋ ฅ ์‹œ DoS(์„œ๋น„์Šค ๊ฑฐ๋ถ€) ๋ฐ OOM(๋ฉ”๋ชจ๋ฆฌ ๋ถ€์กฑ) ์ทจ์•ฝ์ ์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
**Learning:** ์ œํ•œ ์—†์ด ์‚ฌ์šฉ์ž ์ž…๋ ฅ์„ ํ—ˆ์šฉํ•˜๊ณ  ์ด๋ฅผ ๋น„์‹ผ ์—ฐ์‚ฐ(์˜ˆ: `File.absoluteFile.toPath().normalize()`)์— ์ „๋‹ฌํ•  ๊ฒฝ์šฐ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ฆฌ์†Œ์Šค๋ฅผ ๊ณ ๊ฐˆ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
**Prevention:** ์‚ฌ์šฉ์ž ์ œ๊ณต ๊ฒฝ๋กœ๋‚˜ ๋ฌธ์ž์—ด์„ ์ฒ˜๋ฆฌํ•  ๋•Œ๋Š” ํŒŒ์ผ ์‹œ์Šคํ…œ ์ƒํ˜ธ์ž‘์šฉ ์ „์— ํ•ญ์ƒ ๋ช…์‹œ์ ์ธ ์ตœ๋Œ€ ๊ธธ์ด ๊ฒฝ๊ณ„(์˜ˆ: `require(topDir.length <= 4096)`)๋ฅผ ์„ค์ •ํ•˜์—ฌ ๋ฐฉ์–ดํ•˜์‹ญ์‹œ์˜ค.
1 change: 1 addition & 0 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ internal fun read_file_identity(file: File): FileIdentity {

fun go(topDir: String, maxLevel: Int) {
require(topDir.isNotBlank())
require(topDir.length <= 4096) { "Directory path exceeds maximum allowed length of 4096 characters" }
require(!topDir.contains("..")) { "Path traversal sequences are not allowed." }
// ๋ณด์•ˆ ์ˆ˜์ •: symlink ๊ฒ€์‚ฌ๋ฅผ ์šฐํšŒํ•˜๋Š” canonicalFile ๋Œ€์‹  absoluteFile์„ ์‚ฌ์šฉ
// canonicalFile์€ symlink๋ฅผ ๋Œ€์ƒ ๊ฒฝ๋กœ๋กœ ํ•ด์„ํ•˜์—ฌ ์ด์–ด์ง€๋Š” NOFOLLOW_LINKS ๊ฒ€์‚ฌ๋ฅผ ๋ฌด๋ ฅํ™”ํ•ฉ๋‹ˆ๋‹ค.
Expand Down
6 changes: 6 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,12 @@ class MainTest {
go(" ", -1)
}

@Test(expected = IllegalArgumentException::class)
fun testGoRejectsExcessivelyLongPath() {
val longPath = "a".repeat(4097)
go(longPath, -1)
}

@Test
fun testUrlEncodePathUnreserved() {
assertEquals("-._~", "-._~".urlEncodePath())
Expand Down
Loading