Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@
^\.jules(/.*)?$
^\.trivyignore\.yaml$
^trivy\.yaml$
^\.markdownlint\.json$
^\.semgrepignore$
^test_dummy\.R$
^test_validation\.R$
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-08-14 - μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš° λ°©μ§€λ₯Ό μœ„ν•œ readline μž…λ ₯κ°’ 검증 κ°•ν™”
**Vulnerability:** `R/aFIPC.R` λ‚΄μ—μ„œ μ‚¬μš©μž μž…λ ₯을 받을 λ•Œ μ •κ·œμ‹ `^[0-9]+$`λ₯Ό μ‚¬μš©ν•΄ 맀우 큰 숫자 μž…λ ₯ μ‹œ μ˜€λ²„ν”Œλ‘œμš°κ°€ λ°œμƒ, `as.integer()`μ—μ„œ `NA`λ₯Ό λ°˜ν™˜ν•΄ 후속 μ²˜λ¦¬μ— μ—λŸ¬λ₯Ό μ•ΌκΈ°ν•  수 있음 (integer overflow coercion vulnerability).
**Learning:** `readline()`κ³Ό 같은 μƒν˜Έμž‘μš© μž…λ ₯의 경우 λ‹¨μˆœν•œ 숫자 문자 클래슀(`[0-9]+`)보닀 μž…λ ₯받을 κ°’μ˜ λ²”μœ„λ₯Ό λͺ…ν™•νžˆ μ œν•œν•˜λŠ” 것이 μ€‘μš”ν•¨.
**Prevention:** ν–₯ν›„ μž…λ ₯값을 검증할 λ•Œ ν—ˆμš©λ˜λŠ” μ •ν™•ν•œ κ°’(예: `^[12]$`)에 λŒ€ν•΄μ„œλ§Œ λ§€μΉ­ν•˜λ„λ‘ μ •κ·œμ‹μ„ μž‘μ„±ν•΄μ•Ό 함.
5 changes: 5 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"MD013": false,
"MD041": false,
"MD022": false
}
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))
}
}
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
Loading
Loading