Skip to content
Closed
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 @@ -2,3 +2,8 @@
**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-11 - λŒ€ν™”ν˜• R ν”„λ‘¬ν”„νŠΈ μž…λ ₯κ°’ 검증 κ°•ν™”
**Vulnerability:** λŒ€ν™”ν˜• ν”„λ‘¬ν”„νŠΈ(`readline()`)의 μž…λ ₯값을 `grepl("^[0-9]+$", n)`κ³Ό 같이 κ²€μ¦ν•˜λ©΄ κ³Όλ„ν•˜κ²Œ 큰 μˆ«μžκ°€ μž…λ ₯될 경우 `as.integer()` κ³Όμ •μ—μ„œ μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš°κ°€ λ°œμƒν•˜μ—¬ `NA`둜 λ³€ν™˜λ˜κ³  ν”„λ‘œμ„ΈμŠ€κ°€ μΆ©λŒν•  수 μžˆλŠ” 취약점이 μžˆμŠ΅λ‹ˆλ‹€.
**Learning:** R μŠ€ν¬λ¦½νŠΈμ—μ„œ μž…λ ₯값을 받을 λ•ŒλŠ” μ˜ˆμƒλ˜λŠ” μ •ν™•ν•œ κ°’λ§Œ 받도둝 μ •κ·œν‘œν˜„μ‹μ„ μ—„κ²©ν•˜κ²Œ μ œν•œν•΄μ•Ό ν•©λ‹ˆλ‹€.
**Prevention:** `readline()`을 ν†΅ν•œ 숫자 μž…λ ₯을 검증할 λ•Œ λ‹¨μˆœν•œ 숫자 νŒ¨ν„΄(`^[0-9]+$`) λŒ€μ‹  μ˜ˆμƒλ˜λŠ” κ°’κ³Ό μ •ν™•νžˆ μΌμΉ˜ν•˜λŠ” νŒ¨ν„΄(예: `^[12]$`)을 μ‚¬μš©ν•˜μ—¬ μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš° κ°•μ œ λ³€ν™˜ 취약점을 λ°©μ§€ν•΄μ•Ό ν•©λ‹ˆλ‹€.
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