diff --git a/.Jules/palette.md b/.Jules/palette.md deleted file mode 100644 index 84884829..00000000 --- a/.Jules/palette.md +++ /dev/null @@ -1,3 +0,0 @@ -## 2024-07-13 - R Backend Package without Frontend -**Learning:** 본 프로젝트(aFIPC)는 순수 R 백엔드 패키지이며, HTML/React/CSS 등의 프론트엔드 UI 컴포넌트가 존재하지 않음을 재차 확인했습니다. -**Action:** 사용자 인터페이스 개선(UX/a11y)을 적용할 대상이 없으므로, PR을 생성하지 않고 작업을 종료합니다. diff --git a/.jules/sentinel.md b/.jules/sentinel.md index a8207a48..b8420c53 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-08-13 - Fix DoS vulnerability in readline integer coercion +**Vulnerability:** Weak regex validation (`^[0-9]+$`) allows large numbers to be entered in `readline()` which coerces to `NA` via `as.integer()`, breaking `if` conditions and causing unhandled exceptions. +**Learning:** In R, large integer inputs coerce to `NA` leading to unexpected vulnerabilities. +**Prevention:** Use strictly bounded exact-match regex like `^[12]$` to prevent coercion crashes and DoS vulnerabilities. diff --git a/.semgrepignore b/.semgrepignore deleted file mode 100644 index 570a1149..00000000 --- a/.semgrepignore +++ /dev/null @@ -1 +0,0 @@ -packrat/** diff --git a/R/aFIPC.R b/R/aFIPC.R index 62546519..918e19b1 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)) } }