From a8b869970a3604bbd0b288e08df5117f41d1b11a Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 13 Sep 2026 19:13:04 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20?= =?UTF-8?q?=EB=8C=80=ED=99=94=ED=98=95=20=ED=94=84=EB=A1=AC=ED=94=84?= =?UTF-8?q?=ED=8A=B8=EC=9D=98=20=EC=A0=95=EC=88=98=20=EC=98=A4=EB=B2=84?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=20=EC=B7=A8=EC=95=BD=EC=A0=90(DoS)=20?= =?UTF-8?q?=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..2a229da6 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:** 대화형 프롬프트에서 `grepl("^[0-9]+$", n)` 정규식을 사용해 입력을 검증한 후 `as.integer()`로 변환할 때, 매우 큰 숫자가 입력되면 R에서 정수 오버플로가 발생하여 `NA`가 반환되고 애플리케이션 크래시가 일어날 수 있습니다. +**Learning:** R에서 사용자 입력(문자열)을 정수로 강제 변환할 때, 단순 정규식 검증은 큰 수에 대한 오버플로를 방어하지 못하며 치명적인 에러로 이어질 수 있습니다. +**Prevention:** 지정된 선택지만 있는 경우, 정규식보다는 `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 4903bd7cacf311eb56637f946ae0d9d150c1c370 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 13 Sep 2026 19:23:03 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20?= =?UTF-8?q?=EB=8C=80=ED=99=94=ED=98=95=20=ED=94=84=EB=A1=AC=ED=94=84?= =?UTF-8?q?=ED=8A=B8=EC=9D=98=20=EC=A0=95=EC=88=98=20=EC=98=A4=EB=B2=84?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=20=EC=B7=A8=EC=95=BD=EC=A0=90(DoS)=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 33bc58be51333dc1e949997394e57bc64f20bde5 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Mon, 14 Sep 2026 02:29:24 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20?= =?UTF-8?q?=EB=8C=80=ED=99=94=ED=98=95=20=ED=94=84=EB=A1=AC=ED=94=84?= =?UTF-8?q?=ED=8A=B8=EC=9D=98=20=EC=A0=95=EC=88=98=20=EC=98=A4=EB=B2=84?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=20=EC=B7=A8=EC=95=BD=EC=A0=90(DoS)=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From a512af952e946a68236ed7c78dd15f5f5a2cab22 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Mon, 14 Sep 2026 14:13:00 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20?= =?UTF-8?q?=EB=8C=80=ED=99=94=ED=98=95=20=ED=94=84=EB=A1=AC=ED=94=84?= =?UTF-8?q?=ED=8A=B8=EC=9D=98=20=EC=A0=95=EC=88=98=20=EC=98=A4=EB=B2=84?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=20=EC=B7=A8=EC=95=BD=EC=A0=90(DoS)=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit