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
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
^\.jules(/.*)?$
^\.trivyignore\.yaml$
^trivy\.yaml$
^test_dummy\.R$
^test_validation\.R$
^\.semgrepignore$
15 changes: 15 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@
**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-01 - Fix Integer Overflow Coercion Vulnerability
**Vulnerability:** Unbounded numeric regular expressions (`^[0-9]+$`) were used to validate interactive inputs before coercing them to integer using `as.integer()`. If excessively large numbers were provided, they would pass the regex check but coercion would produce `NA`, which could cause unexpected downstream failures or crashes.
**Learning:** In R scripts, validating inputs using `^[0-9]+$` does not account for the limits of R's integer representation. This can lead to integer overflow coercion vulnerabilities.
**Prevention:** Strictly match against exact expected values (e.g., `^[12]$`) instead of unbounded digit classes to ensure the input fits safely within R's integer bounds.

## 2026-08-01 - Avoid committing tarball files downloaded during CI scripts
**Vulnerability:** Inadvertently committing `.tar.gz` and extracted binaries (like `actionlint` or `gitleaks`) into the repository.
**Learning:** During test runs or script execution, tools might be downloaded into the root directory. If the tree isn't cleaned up (or if they are not explicitly gitignored), they can accidentally be committed via blind `git commit -a` or tracked if created locally.
**Prevention:** Avoid explicitly `git add`ing them. Also, use temporary directories to download binaries instead of the repo root or make sure to delete them after use.

## 2026-08-01 - Delete temporary binaries and archives after use
**Vulnerability:** Inadvertently leaving downloaded script files and archives (like `actionlint` or `gitleaks`) in the repository during agent runs.
**Learning:** Tools or archives downloaded during intermediate verification steps (like linting or secrets scanning) can persist and cause unexpected CI verification failures (like R CMD check reporting undeclared executable files).
**Prevention:** Remove any downloaded temporary files (e.g., `rm actionlint actionlint_1.7.10_linux_amd64.tar.gz`) from the repository root immediately after their respective tasks are completed.
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