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-18 - [Fix DoS vector via readline coercion]
**Vulnerability:** `readline()` μž…λ ₯을 `as.integer()`둜 κ°•μ œ λ³€ν™˜ν•˜κΈ° μ „ μ •κ·œν‘œν˜„μ‹ `grepl("^[0-9]+$", n)`λ§Œμ„ μ‚¬μš©ν•˜λ©΄, λ„ˆλ¬΄ κΈ΄ λ¬Έμžμ—΄μ΄ μ •κ·œμ‹μ„ ν†΅κ³Όν•˜μ§€λ§Œ μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš°λ‘œ 인해 `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