Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
^\.jules(/.*)?$
^\.trivyignore\.yaml$
^trivy\.yaml$
^\.semgrepignore$
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-07-26 - Integer Coercion Vulnerability from readline()
**Vulnerability:** When reading integer inputs via `readline()` in R, weak regex validation like `^[0-9]+$` allows large numbers that coerce to `NA` via `as.integer()`, which can break `if` conditions and cause unhandled exceptions.
**Learning:** This weak validation can lead to crashes and Denial of Service (DoS) vulnerabilities when large input bypasses length limits or expected integer bounds.
**Prevention:** Use strictly bounded exact-match regex like `^[12]$` for options selection to prevent coercion crashes and ensure inputs are within acceptable boundaries before converting to integer.
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))
}
Comment on lines 141 to 146
}
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
18 changes: 18 additions & 0 deletions aFIPC.Rcheck/00_pkg_src/aFIPC/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Package: aFIPC
Type: Package
Title: Automated Fixed Item Parameter Linking
Version: 0.1.0
Author: Seongho Bae [aut, cre]
Maintainer: Seongho Bae <seongho@kw.ac.kr>
Authors@R: person(given = "Seongho", family = "Bae", role = c("aut", "cre"),
email = "seongho@kw.ac.kr")
Description: Automates fixed item parameter linking for test linking under
the item response theory paradigm using mirt package estimates.
License: GPL-3 | file LICENSE
Imports: mirt, methods
Suggests: testthat (>= 3.0.0)
Encoding: UTF-8
Config/testthat/edition: 3
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-07-26 16:50:15 UTC; jules
2 changes: 2 additions & 0 deletions aFIPC.Rcheck/00_pkg_src/aFIPC/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2026
COPYRIGHT HOLDER: Seongho Bae
5 changes: 5 additions & 0 deletions aFIPC.Rcheck/00_pkg_src/aFIPC/NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(autoFIPC)
export(surveyFA)
import(mirt)
Loading
Loading