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
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 - [CRITICAL] 대화형 입력의 정수 오버플로 취약점 수정
**Vulnerability:** `readline()` 입력 처리 시 `^[0-9]+$` 정규식을 사용하여 무제한 자릿수의 숫자 문자열을 허용함. 이로 인해 과도하게 큰 숫자가 입력될 경우 `as.integer()`에서 `NA`로 평가되어 후속 프로세스 크래시를 유발함.
**Learning:** 정수형 입력값 검증 시 길이 제한이나 정확한 값 매칭 없이 범용적인 숫자 클래스(`[0-9]`)를 반복 매칭할 경우 예상치 못한 타입 강제 변환(coercion) 취약점이 발생할 수 있음을 확인.
**Prevention:** 인터랙티브 입력에서 1 또는 2와 같은 특정 선택지만 허용해야 하는 경우, 무제한 자릿수를 허용하는 `^[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)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Interactive validation remains untested

The suite never reaches any changed readline() validator. Add regression coverage for valid choices, oversized numbers, and three invalid attempts.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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