From fe8eb890fd8c504a300b49a34a9a1eea440ccd17 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 25 Jul 2026 19:02:53 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=EB=8C=80=ED=99=94=ED=98=95=20=ED=94=84?= =?UTF-8?q?=EB=A1=AC=ED=94=84=ED=8A=B8=EC=9D=98=20=EB=AC=B4=EC=A0=9C?= =?UTF-8?q?=ED=95=9C=20=EC=88=AB=EC=9E=90=20=EC=9E=85=EB=A0=A5=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=A0=95=EC=88=98=20=EC=98=A4?= =?UTF-8?q?=EB=B2=84=ED=94=8C=EB=A1=9C=20=EB=B0=8F=20=EA=B0=95=EC=A0=9C=20?= =?UTF-8?q?=EB=B3=80=ED=99=98=20=EC=B7=A8=EC=95=BD=EC=A0=90=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(interactive=20readline=20integer=20overflow=20coer?= =?UTF-8?q?cion=20vulnerability)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .jules/sentinel.md | 5 +++++ R/aFIPC.R | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.jules/sentinel.md b/.jules/sentinel.md index a8207a4..595ade5 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -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-07-25 - [Integer Overflow Coercion Vulnerability] +**Vulnerability:** Unbounded regex `^[0-9]+$` on interactive `readline()` prompt allowed excessively large digit inputs which evaluate to `NA` inside `as.integer()`, leading to subsequent process crashes or unexpected state in automated/headless setups. +**Learning:** Even simple boolean/menu choice prompts ("1: Yes 2: No") are susceptible to overflow/type vulnerabilities if validated loosely. Coercing unbounded input via `as.integer()` fails silently to `NA`. +**Prevention:** Strictly limit regex matches to expected choice domains (e.g., `^[12]$`) instead of generic digit classes when prompting for specific integer flags. diff --git a/R/aFIPC.R b/R/aFIPC.R index 6254651..918e19b 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 (grepl("^[12]$", n)) { 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 (grepl("^[12]$", n)) { 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 (grepl("^[12]$", n)) { return(as.integer(n)) } } From 6a2c4ad9ef5d89bdc89416d81ad59378761a9f77 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 25 Jul 2026 19:18:23 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=EB=8C=80=ED=99=94=ED=98=95=20=ED=94=84?= =?UTF-8?q?=EB=A1=AC=ED=94=84=ED=8A=B8=EC=9D=98=20=EB=AC=B4=EC=A0=9C?= =?UTF-8?q?=ED=95=9C=20=EC=88=AB=EC=9E=90=20=EC=9E=85=EB=A0=A5=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=A0=95=EC=88=98=20=EC=98=A4?= =?UTF-8?q?=EB=B2=84=ED=94=8C=EB=A1=9C=20=EB=B0=8F=20=EA=B0=95=EC=A0=9C=20?= =?UTF-8?q?=EB=B3=80=ED=99=98=20=EC=B7=A8=EC=95=BD=EC=A0=90=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(interactive=20readline=20integer=20overflow=20coer?= =?UTF-8?q?cion=20vulnerability)=20=EB=B0=8F=20Rbuildignore=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .Rbuildignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.Rbuildignore b/.Rbuildignore index 232504f..28b2d85 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -22,3 +22,6 @@ ^\.jules(/.*)?$ ^\.trivyignore\.yaml$ ^trivy\.yaml$ +^\.semgrepignore$ +^test_dummy\.R$ +^test_validation\.R$ From 7f7c1c55c54f1e423ed06ee199fbaed1f784439b Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 25 Jul 2026 19:34:01 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=EB=8C=80=ED=99=94=ED=98=95=20=ED=94=84?= =?UTF-8?q?=EB=A1=AC=ED=94=84=ED=8A=B8=EC=9D=98=20=EB=AC=B4=EC=A0=9C?= =?UTF-8?q?=ED=95=9C=20=EC=88=AB=EC=9E=90=20=EC=9E=85=EB=A0=A5=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=A0=95=EC=88=98=20=EC=98=A4?= =?UTF-8?q?=EB=B2=84=ED=94=8C=EB=A1=9C=20=EB=B0=8F=20=EA=B0=95=EC=A0=9C=20?= =?UTF-8?q?=EB=B3=80=ED=99=98=20=EC=B7=A8=EC=95=BD=EC=A0=90=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(interactive=20readline=20integer=20overflow=20coer?= =?UTF-8?q?cion=20vulnerability)=20=EB=B0=8F=20Rbuildignore=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/r.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index cf2e656..d79c3d8 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -35,6 +35,9 @@ jobs: r-version: release use-public-rspm: true + - name: Install libcurl + run: sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev + - name: Set up R package dependencies uses: r-lib/actions/setup-r-dependencies@d3c5be51b12e724e68f33216ca3c148b66d5f0b6 with: @@ -45,4 +48,4 @@ jobs: uses: r-lib/actions/check-r-package@6f6e5bc62fba3a704f74e7ad7ef7676c5c6a2590 with: args: 'c("--no-manual", "--as-cran")' - error-on: '"error"' + error-on: '"warning"' From cb0876299b052b1d54b51ddba8d88ff2849cd61d Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 25 Jul 2026 19:44:36 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=EB=8C=80=ED=99=94=ED=98=95=20=ED=94=84?= =?UTF-8?q?=EB=A1=AC=ED=94=84=ED=8A=B8=EC=9D=98=20=EB=AC=B4=EC=A0=9C?= =?UTF-8?q?=ED=95=9C=20=EC=88=AB=EC=9E=90=20=EC=9E=85=EB=A0=A5=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=A0=95=EC=88=98=20=EC=98=A4?= =?UTF-8?q?=EB=B2=84=ED=94=8C=EB=A1=9C=20=EB=B0=8F=20=EA=B0=95=EC=A0=9C=20?= =?UTF-8?q?=EB=B3=80=ED=99=98=20=EC=B7=A8=EC=95=BD=EC=A0=90=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(interactive=20readline=20integer=20overflow=20coer?= =?UTF-8?q?cion=20vulnerability)=20=EB=B0=8F=20Rbuildignore/CI=20=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/r.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index d79c3d8..b0171b8 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -35,14 +35,11 @@ jobs: r-version: release use-public-rspm: true - - name: Install libcurl - run: sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev + - name: Install System Dependencies + run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev - - name: Set up R package dependencies - uses: r-lib/actions/setup-r-dependencies@d3c5be51b12e724e68f33216ca3c148b66d5f0b6 - with: - extra-packages: any::rcmdcheck - needs: check + - name: Install R Dependencies + run: Rscript -e 'install.packages(c("mirt", "testthat", "rcmdcheck"), repos="https://cloud.r-project.org")' - name: Run R CMD check uses: r-lib/actions/check-r-package@6f6e5bc62fba3a704f74e7ad7ef7676c5c6a2590