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-08-18 - λŒ€ν™”ν˜• μž…λ ₯κ°’ 검증 μ‹œ μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš° λ°©μ§€
**Vulnerability:** λŒ€ν™”ν˜• `readline()` μž…λ ₯을 검증할 λ•Œ 경계가 μ—†λŠ” 숫자 μ •κ·œμ‹(`^[0-9]+$`)을 μ‚¬μš©ν•˜λ©΄, μ•…μ˜μ μœΌλ‘œ 큰 μˆ«μžκ°€ μž…λ ₯될 경우 `as.integer()`μ—μ„œ `NA`둜 κ°•μ œ λ³€ν™˜λ˜μ–΄ 이후 ν”„λ‘œμ„ΈμŠ€μ—μ„œ μ˜ˆμƒμΉ˜ λͺ»ν•œ 였λ₯˜λ‚˜ 쀑단(Denial of Service)이 λ°œμƒν•  수 μžˆμŠ΅λ‹ˆλ‹€.
**Learning:** 숫자 μž…λ ₯ 검증 μ‹œμ—λŠ” ν—ˆμš©λ˜λŠ” μ •ν™•ν•œ κ°’(예: `^[12]$`)만 λ§€μΉ­λ˜λ„λ‘ μ •κ·œν‘œν˜„μ‹μ„ μ œν•œν•˜μ—¬ μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš°λ‘œ μΈν•œ 취약점을 λ°©μ§€ν•΄μ•Ό ν•©λ‹ˆλ‹€.
**Prevention:** `readline()`κ³Ό 같은 ν•¨μˆ˜λ‘œ μž…λ ₯값을 받을 λ•ŒλŠ” ν—ˆμš©λœ λ²”μœ„μ˜ μ •ν™•ν•œ 값을 λ§€μΉ­ν•˜λŠ” μ •κ·œμ‹μ„ μ‚¬μš©ν•˜μ—¬ μž…λ ₯ 검증을 μ—„κ²©ν•˜κ²Œ μˆ˜ν–‰ν•©λ‹ˆλ‹€.
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 (grepl("^[12]$", n)) {
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 (grepl("^[12]$", n)) {
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 (grepl("^[12]$", n)) {
return(as.integer(n))
}
}
Expand Down
Loading