Skip to content
Open
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
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
^registered_agents\.json$
^task_agent_mapping\.json$
^\.gitleaks\.toml$
^\.jules$
^\.jules/.*
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2024-06-27 - [Infinite Recursion DoS in Non-Interactive Environments]
**Vulnerability:** The legacy `readline()` prompts use unbounded recursion on invalid inputs, causing a C stack overflow (DoS) when executed in headless/CI environments.
**Learning:** Automated/non-interactive execution environments supply `""` or `EOF` to `readline()`, which fails validation regexes and triggers the infinite recursion loop.
**Prevention:** Always wrap interactive prompts with `interactive()` checks and provide safe, deterministic default fallbacks for headless execution.
6 changes: 6 additions & 0 deletions R/aFIPC.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ autoFIPC <-
data.frame(cbind(newformCommonItemNames, oldformCommonItemNames))

checkCorrect <- function() {
# Security fix: Prevent infinite recursion DoS in non-interactive environments
if (!interactive()) return(1L)
n <- readline(prompt = "Is it correct? (1: Yes 2: No) : ")
if (!grepl("^[0-9]+$", n)) {
return(checkCorrect())
Expand All @@ -99,6 +101,8 @@ autoFIPC <-
oldformYDataK <- oldformYData
if (itemtype == '3PL' && length(oldformBILOGprior) == 0) {
checkoldformBILOGprior <- function() {
# Security fix: Prevent infinite recursion DoS in non-interactive environments
if (!interactive()) return(1L)
n <-
readline(
prompt = "Do you want to use default BILOG-MG priors for oldform Data? (1: Yes 2: No) : "
Expand Down Expand Up @@ -310,6 +314,8 @@ autoFIPC <-
newformXDataK <- newformXData
if (itemtype == '3PL' && length(newformBILOGprior) == 0) {
checknewformBILOGprior <- function() {
# Security fix: Prevent infinite recursion DoS in non-interactive environments
if (!interactive()) return(1L)
n <-
readline(
prompt = "Do you want to use default BILOG-MG priors for newform Data? (1: Yes 2: No) : "
Expand Down
Loading