Skip to content
Draft
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 - [μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš° λ°©μ§€λ₯Ό μœ„ν•œ μž…λ ₯κ°’ 검증 κ°•ν™”]
**Vulnerability:** λŒ€ν™”ν˜• ν”„λ‘¬ν”„νŠΈ μž…λ ₯(`readline()`)을 검증할 λ•Œ `grepl("^[0-9]+$", n)`κ³Ό 같은 μ •κ·œν‘œν˜„μ‹λ§Œ μ‚¬μš©ν•˜λ©΄, 맀우 큰 숫자 λ¬Έμžμ—΄μ΄ μ •κ·œν‘œν˜„μ‹μ„ ν†΅κ³Όν•œ ν›„ `as.integer()`둜 λ³€ν™˜λ  λ•Œ μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš°λ₯Ό 일으켜 `NA`λ₯Ό λ°˜ν™˜ν•˜κ²Œ 되며, 이둜 인해 μ• ν”Œλ¦¬μΌ€μ΄μ…˜ ν¬λž˜μ‹œ(DoS)κ°€ λ°œμƒν•  수 있음.
**Learning:** 숫자 λ¬Έμžμ—΄ 검증 μ‹œ ν—ˆμš© κ°€λŠ₯ν•œ λ²”μœ„λ₯Ό λͺ…μ‹œμ μœΌλ‘œ ν™•μΈν•˜μ§€ μ•Šκ³  λ‹¨μˆœ ν˜•νƒœν•™μ  검증(μ •κ·œν‘œν˜„μ‹)에 μ˜μ‘΄ν•˜λ©΄ 예기치 λͺ»ν•œ νƒ€μž… λ³€ν™˜ λ¬Έμ œκ°€ λ°œμƒν•  수 μžˆλ‹€λŠ” 것을 μ•Œκ²Œ 됨.
**Prevention:** 사전에 μ •μ˜λœ μ˜΅μ…˜ μ„ΈνŠΈ λ‚΄μ˜ 값인지 ν™•μΈν•˜λŠ” μ—„κ²©ν•œ 일치 검증(예: `n %in% c("1", "2")`)을 μ‚¬μš©ν•˜μ—¬ μž…λ ₯값을 μ œν•œν•˜κ³  μ•ˆμ „ν•˜κ²Œ μ²˜λ¦¬ν•΄μ•Ό 함.
6 changes: 3 additions & 3 deletions R/aFIPC.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ autoFIPC <-
}
for (attempt in seq_len(3)) {
n <- readline(prompt = "Is it correct? (1: Yes 2: No) : ")
if (grepl("^[0-9]+$", n)) {
if (n %in% c("1", "2")) {
return(as.integer(n))
}
}
Expand Down Expand Up @@ -171,7 +171,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)) {
if (n %in% c("1", "2")) {
return(as.integer(n))
}
}
Expand Down Expand Up @@ -390,7 +390,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)) {
if (n %in% c("1", "2")) {
return(as.integer(n))
}
}
Expand Down
Loading