From 65b528df4e68635d880921a7893ab8af1b813139 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Thu, 17 Sep 2026 19:11:16 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=EA=B0=92=20=EA=B2=80=EC=A6=9D=20=EC=A0=95?= =?UTF-8?q?=EC=88=98=20=EC=98=A4=EB=B2=84=ED=94=8C=EB=A1=9C=20=EC=B7=A8?= =?UTF-8?q?=EC=95=BD=EC=A0=90(DoS)=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .jules/sentinel.md | 4 ++++ R/aFIPC.R | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.jules/sentinel.md b/.jules/sentinel.md index a8207a48..63a0ba7a 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -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 - [보안: 정수 오버플로 및 DoS 취약점 수정] +**Vulnerability:** 대화형 입력(`readline`) 시 `grepl("^[0-9]+$", n)` 정규식만으로 입력값을 검증하여, 매우 큰 숫자가 입력되었을 때 `as.integer()`에서 오버플로가 발생(`NA` 반환)해 이후 논리 연산에서 애플리케이션 크래시(DoS)가 발생하는 취약점이 존재함. +**Learning:** `grepl("^[0-9]+$", n)`은 단순한 숫자 형태인지만 검사하므로 정수 표현 범위를 초과하는 악의적 입력이나 극단적으로 큰 값을 걸러내지 못함. R에서 `NA`는 논리 연산식에 들어가면 에러를 발생시킴. +**Prevention:** 미리 정의된 선택지(예: "1", "2")만 입력받는 경우, 정규식 대신 정확한 값 일치(`n %in% c("1", "2")`)를 통해 안전하게 입력을 검증해야 함. diff --git a/R/aFIPC.R b/R/aFIPC.R index 62546519..118aca09 100644 --- a/R/aFIPC.R +++ b/R/aFIPC.R @@ -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)) } } @@ -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)) } } @@ -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)) } } From c6822614d177ac49415fda3d297ff20795567339 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Fri, 18 Sep 2026 04:54:59 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=EA=B0=92=20=EA=B2=80=EC=A6=9D=20=EC=A0=95?= =?UTF-8?q?=EC=88=98=20=EC=98=A4=EB=B2=84=ED=94=8C=EB=A1=9C=20=EC=B7=A8?= =?UTF-8?q?=EC=95=BD=EC=A0=90(DoS)=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/aFIPC.R | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/R/aFIPC.R b/R/aFIPC.R index 118aca09..8085f1d6 100644 --- a/R/aFIPC.R +++ b/R/aFIPC.R @@ -141,9 +141,7 @@ autoFIPC <- } for (attempt in seq_len(3)) { n <- readline(prompt = "Is it correct? (1: Yes 2: No) : ") - if (n %in% c("1", "2")) { - return(as.integer(n)) - } + if (n %in% c("1", "2")) return(as.integer(n)) } stop("Too many invalid common item confirmation attempts") } @@ -171,9 +169,7 @@ autoFIPC <- readline( prompt = "Do you want to use default BILOG-MG priors for oldform Data? (1: Yes 2: No) : " ) - if (n %in% c("1", "2")) { - return(as.integer(n)) - } + if (n %in% c("1", "2")) return(as.integer(n)) } stop("Too many invalid oldform BILOG prior attempts") } @@ -390,9 +386,7 @@ autoFIPC <- readline( prompt = "Do you want to use default BILOG-MG priors for newform Data? (1: Yes 2: No) : " ) - if (n %in% c("1", "2")) { - return(as.integer(n)) - } + if (n %in% c("1", "2")) return(as.integer(n)) } stop("Too many invalid newform BILOG prior attempts") }