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 @@ -24,3 +24,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-05-24 - [μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš° λ°©μ§€λ₯Ό μœ„ν•œ μž…λ ₯ 검증 κ°•ν™”]
**Vulnerability:** `readline()`을 톡해 μ‚¬μš©μž μž…λ ₯을 받을 λ•Œ `^[0-9]+$` μ •κ·œμ‹μ„ μ‚¬μš©ν•˜μ—¬ μž…λ ₯을 κ²€μ¦ν–ˆμŠ΅λ‹ˆλ‹€.
**Learning:** `^[0-9]+$` μ •κ·œμ‹μ€ μ œν•œμ΄ μ—†μ–΄ 맀우 큰 μˆ«μžκ°€ μž…λ ₯될 경우 `as.integer()`μ—μ„œ μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš°(integer overflow)κ°€ λ°œμƒν•΄ `NA`λ₯Ό λ°˜ν™˜ν•˜κ³ , 이둜 인해 이후 λ‘œμ§μ—μ„œ μ˜ˆμƒμΉ˜ λͺ»ν•œ μ—λŸ¬λ‚˜ ν”„λ‘œμ„ΈμŠ€ ν¬λž˜μ‹œλ₯Ό μœ λ°œν•  수 μžˆμŒμ„ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.
**Prevention:** `readline()`으둜 `1` λ˜λŠ” `2`와 같이 μ œν•œλœ μ„ νƒμ§€λ§Œ λ°›μ•„μ•Ό ν•˜λŠ” κ²½μš°μ—λŠ” `^[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,
"MD022": false,
"MD041": 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