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
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-27 - λŒ€ν™”ν˜• ν”„λ‘¬ν”„νŠΈμ˜ μ •μˆ˜ μ˜€λ²„ν”Œλ‘œ 취약점 μˆ˜μ •
**Vulnerability:** λŒ€ν™”ν˜• `readline()` 숫자 μž…λ ₯에 λŒ€ν•΄ `^[0-9]+$`와 같이 μ œν•œ μ—†λŠ” 숫자 클래슀λ₯Ό μ‚¬μš©ν•˜μ—¬ 검증할 λ•Œ, μ§€λ‚˜μΉ˜κ²Œ 큰 숫자 λ¬Έμžμ—΄μ΄ μ •κ·œμ‹ 검사λ₯Ό ν†΅κ³Όν•˜μ§€λ§Œ `as.integer()`μ—μ„œ `NA`둜 ν‰κ°€λ˜μ–΄ 이후 ν”„λ‘œμ„ΈμŠ€ 좩돌(μ •μˆ˜ μ˜€λ²„ν”Œλ‘œ κ°•μ œ λ³€ν™˜ 취약점)을 μœ λ°œν•  수 μžˆμŠ΅λ‹ˆλ‹€.
**Learning:** Rμ—μ„œ λŒ€ν™”ν˜• 숫자 μž…λ ₯을 검증할 λ•Œ, μ œν•œ μ—†λŠ” 숫자 λ²”μœ„λ³΄λ‹€λŠ” μ˜ˆμƒλ˜λŠ” μ •ν™•ν•œ κ°’(예: `^[12]$`)κ³Ό μΌμΉ˜μ‹œμΌœμ•Ό ν•©λ‹ˆλ‹€.
**Prevention:** ν–₯ν›„ μž…λ ₯ 검증 λ‘œμ§μ—μ„œλŠ” 항상 μ œν•œλœ 길이와 μ •ν™•ν•œ λ²”μœ„λ₯Ό ν™•μΈν•˜λ„λ‘ μ •κ·œμ‹μ„ μž‘μ„±ν•΄μ•Ό ν•©λ‹ˆλ‹€.
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)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ“ Info: Regex tightening preserves valid-input behavior

The three prompts change ^[0-9]+$ to ^[12]$. Only 1/2 are meaningful and their handling is unchanged in checkCorrect, checkoldformBILOGprior, and checknewformBILOGprior. Other digit inputs, once accepted then rejected downstream, are now retried up to three times before stopping.

Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

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