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 @@ -12,3 +12,8 @@
**Vulnerability:** Raw `stop()` and `warning()` calls without `call. = FALSE` in `llcont.R` and `vuongtest.R` exposed execution stack/call details when raised.
**Learning:** While some instances of `stop()` inside `tryCatch()` were previously fixed to hide the call stack, other standalone exceptions and warnings still leaked call context. Security must be consistently applied across the entire codebase.
**Prevention:** Always set `call. = FALSE` when using `stop()` or `warning()` to enforce a secure-by-default boundary and prevent internal execution paths from being disclosed to the end user.

## 2024-05-18 - Input Validation at Exported Boundary
**Vulnerability:** Unvalidated inputs like `conf.level` and `nested` passed to top-level exported functions triggered unhandled base R errors (e.g., `non-numeric argument to binary operator` or `argument is not interpretable as logical`), potentially leaking internal execution context and state.
**Learning:** In R codebases, unvalidated arguments passed to exported functions can bypass top-level safeguards and trigger raw R errors deep inside internal logic.
**Prevention:** Always strictly validate the type, length, and bounds of user inputs at the very beginning of exported functions and fail securely using `stop("...", call. = FALSE)`.
3 changes: 3 additions & 0 deletions R/icci.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
#' @importFrom stats AIC var qnorm
#' @export
icci <- function(object1, object2, conf.level=.95, ll1=llcont, ll2=llcont) {
if (!is.numeric(conf.level) || length(conf.level) != 1 || is.na(conf.level) || conf.level <= 0 || conf.level >= 1) {
stop("conf.level must be a single numeric value between 0 and 1", call. = FALSE)
}
Comment on lines +67 to +69

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๐Ÿ“ Maintainability & Code Quality | ๐ŸŸก Minor | โšก Quick win

๋‚ด๋ณด๋‚ธ ํ•จ์ˆ˜์˜ ์ž…๋ ฅ ๊ณ„์•ฝ์„ ๋ฌธ์„œ์— ๋™์ผํ•˜๊ฒŒ ๋ฐ˜์˜ํ•˜์„ธ์š”.

  • R/icci.R#L67-L69: conf.level์ด ๋‹จ์ผ ๋น„๊ฒฐ์ธก ์ˆซ์ž์ด๋ฉฐ 0 < conf.level < 1์ด์–ด์•ผ ํ•œ๋‹ค๋Š” ์กฐ๊ฑด์„ @param๊ณผ man/icci.Rd์— ์ถ”๊ฐ€ํ•˜์„ธ์š”.
  • R/vuongtest.R#L100-L102: nested๊ฐ€ ๋‹จ์ผ ๋น„๊ฒฐ์ธก ๋…ผ๋ฆฌ๊ฐ’์ด์–ด์•ผ ํ•œ๋‹ค๋Š” ์กฐ๊ฑด์„ @param๊ณผ man/vuongtest.Rd์— ์ถ”๊ฐ€ํ•˜์„ธ์š”.
๐Ÿ“ Affects 2 files
  • R/icci.R#L67-L69 (this comment)
  • R/vuongtest.R#L100-L102
๐Ÿค– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@R/icci.R` around lines 67 - 69, Update the exported function documentation
for R/icci.R lines 67-69 by adding the conf.level input contract to its `@param`
entry and man/icci.Rd: it must be a single non-missing numeric value with 0 <
conf.level < 1. Update R/vuongtest.R lines 100-102 and the corresponding `@param`
entry and man/vuongtest.Rd documentation to state that nested must be a single
non-missing logical value.


## check objects, issue warnings/errors, get classes/calls
obinfo <- check.obj(object1, object2)
Expand Down
3 changes: 3 additions & 0 deletions R/vuongtest.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
#' @importFrom methods slotNames
#' @export
vuongtest <- function(object1, object2, nested=FALSE, adj="none", ll1=llcont, ll2=llcont, score1=NULL, score2=NULL, vc1=vcov, vc2=vcov) {
if (!is.logical(nested) || length(nested) != 1 || is.na(nested)) {
stop("nested must be a single logical value", call. = FALSE)
}

## check objects, issue warnings/errors, get classes/calls
obinfo <- check.obj(object1, object2)
Expand Down
Loading