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
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
**Vulnerability:** Unvalidated inputs passed to `if()` statements can cause process crashes (`condition has length > 1`) or unexpected coercion vulnerabilities.
**Learning:** In R, optional boolean parameters that default to `NULL` should be validated using explicit runtime type validation (e.g., `if (!is.null(flag) && (!is.logical(flag) || length(flag) != 1 || is.na(flag)))`).
**Prevention:** Always implement explicit runtime type validation for optional boolean parameters.
## 2024-05-24 - [λ³΄μ•ˆ: μ •μˆ˜ μ˜€λ²„ν”Œλ‘œ 및 DoS 취약점 μˆ˜μ •]
**Vulnerability:** λŒ€ν™”ν˜• μž…λ ₯(`readline`) μ‹œ `grepl("^[0-9]+$", n)` μ •κ·œμ‹λ§ŒμœΌλ‘œ μž…λ ₯값을 κ²€μ¦ν•˜μ—¬, 맀우 큰 μˆ«μžκ°€ μž…λ ₯λ˜μ—ˆμ„ λ•Œ `as.integer()`μ—μ„œ μ˜€λ²„ν”Œλ‘œκ°€ λ°œμƒ(`NA` λ°˜ν™˜)ν•΄ 이후 논리 μ—°μ‚°μ—μ„œ μ• ν”Œλ¦¬μΌ€μ΄μ…˜ ν¬λž˜μ‹œ(DoS)κ°€ λ°œμƒν•˜λŠ” 취약점이 μ‘΄μž¬ν•¨.
**Learning:** `grepl("^[0-9]+$", n)`은 λ‹¨μˆœν•œ 숫자 ν˜•νƒœμΈμ§€λ§Œ κ²€μ‚¬ν•˜λ―€λ‘œ μ •μˆ˜ ν‘œν˜„ λ²”μœ„λ₯Ό μ΄ˆκ³Όν•˜λŠ” μ•…μ˜μ  μž…λ ₯μ΄λ‚˜ κ·Ήλ‹¨μ μœΌλ‘œ 큰 값을 κ±ΈλŸ¬λ‚΄μ§€ λͺ»ν•¨. Rμ—μ„œ `NA`λŠ” 논리 연산식에 λ“€μ–΄κ°€λ©΄ μ—λŸ¬λ₯Ό λ°œμƒμ‹œν‚΄.
**Prevention:** 미리 μ •μ˜λœ 선택지(예: "1", "2")만 μž…λ ₯λ°›λŠ” 경우, μ •κ·œμ‹ λŒ€μ‹  μ •ν™•ν•œ κ°’ 일치(`n %in% c("1", "2")`)λ₯Ό 톡해 μ•ˆμ „ν•˜κ²Œ μž…λ ₯을 검증해야 함.
12 changes: 3 additions & 9 deletions R/aFIPC.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ autoFIPC <-
}
for (attempt in seq_len(3)) {
n <- readline(prompt = "Is it correct? (1: Yes 2: No) : ")
if (grepl("^[0-9]+$", n)) {
return(as.integer(n))
}
if (n %in% c("1", "2")) return(as.integer(n))
}
stop("Too many invalid common item confirmation attempts")
}
Expand Down Expand Up @@ -171,9 +169,7 @@ autoFIPC <-
readline(
prompt = "Do you want to use default BILOG-MG priors for oldform Data? (1: Yes 2: No) : "
)
if (grepl("^[0-9]+$", n)) {
return(as.integer(n))
}
if (n %in% c("1", "2")) return(as.integer(n))
}
stop("Too many invalid oldform BILOG prior attempts")
}
Expand Down Expand Up @@ -390,9 +386,7 @@ autoFIPC <-
readline(
prompt = "Do you want to use default BILOG-MG priors for newform Data? (1: Yes 2: No) : "
)
if (grepl("^[0-9]+$", n)) {
return(as.integer(n))
}
if (n %in% c("1", "2")) return(as.integer(n))
}
stop("Too many invalid newform BILOG prior attempts")
}
Expand Down
Loading