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
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-21 - μž…λ ₯ κ²€μ¦μ—μ„œ λ°œμƒν•  수 μžˆλŠ” μ •μˆ˜ μ˜€λ²„ν”Œλ‘œμš° 취약점 패치
**Vulnerability:** λŒ€ν™”ν˜• `readline()` ν•¨μˆ˜μ—μ„œ `grepl("^[0-9]+$")`와 같이 길이에 μ œν•œμ΄ μ—†λŠ” μ •κ·œν‘œν˜„μ‹μ„ μ‚¬μš©ν•˜μ—¬ 숫자λ₯Ό 검증할 경우, 맀우 κΈ΄ μˆ«μžκ°€ μž…λ ₯λ˜μ—ˆμ„ λ•Œ `as.integer()` λ³€ν™˜ κ³Όμ •μ—μ„œ μ˜€λ²„ν”Œλ‘œμš°κ°€ λ°œμƒν•˜κ±°λ‚˜ NAκ°€ λ°˜ν™˜λ˜μ–΄ 이후 ν”„λ‘œμ„ΈμŠ€μ—μ„œ ν¬λž˜μ‹œκ°€ λ°œμƒν•  수 μžˆμŠ΅λ‹ˆλ‹€.
**Learning:** R μŠ€ν¬λ¦½νŠΈμ—μ„œ μž…λ ₯값을 검증할 λ•ŒλŠ” μ‚¬μš©μžμ˜ μž…λ ₯이 κΈ°λŒ€ν•˜λŠ” κ°’κ³Ό μ •ν™•νžˆ μΌμΉ˜ν•˜λŠ”μ§€ 확인해야 ν•©λ‹ˆλ‹€. (예: `^[12]$`)
**Prevention:** `readline()`κ³Ό 같은 μž…λ ₯을 검증할 λ•ŒλŠ” κ°€λŠ₯ν•œ κ°’μ˜ λ²”μœ„λ‚˜ ν˜•νƒœλ₯Ό μ •ν™•ν•˜κ²Œ μ§€μ •ν•˜λŠ” μ •κ·œν‘œν˜„μ‹μ„ μ‚¬μš©ν•˜μ—¬ μž…λ ₯ λ²”μœ„λ₯Ό μ—„κ²©ν•˜κ²Œ μ œν•œν•΄μ•Ό ν•©λ‹ˆλ‹€.
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: Non-{1,2} input now retries instead of erroring immediately

Previously any digit sequence was accepted and returned immediately; entering 3 returned 3 and stopped with 'Please write down pairs correctly'. With ^[12]$, 3 is rejected and the loop retries up to 3 times, then stops with 'Too many invalid...'. Both stop; only the error message differs. Downstream only ever treated 1/2 as meaningful, so no functional regression.

Open in 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