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
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2026-06-24 - Input Validation Enhancement
**Vulnerability:** Missing input validation
**Learning:** R functions often lack input validation for arguments like `conf.level`, `nested`, and `adj`, which could lead to unexpected behavior or obscure errors downstream.
**Prevention:** Always validate numeric ranges, logical bounds, and enum choices using `is.numeric`, `is.logical`, and `match.arg`.
5 changes: 5 additions & 0 deletions R/icci.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
#' @export
icci <- function(object1, object2, conf.level=.95, ll1=llcont, ll2=llcont) {

## Input validation
if (!is.numeric(conf.level) || length(conf.level) != 1 || conf.level <= 0 || conf.level >= 1) {
stop("Argument 'conf.level' must be a single numeric value strictly between 0 and 1.")
}
Comment on lines +69 to +71
Comment on lines +68 to +71

## check objects, issue warnings/errors, get classes/calls
obinfo <- check.obj(object1, object2)
callA <- obinfo$callA; classA <- obinfo$classA
Expand Down
8 changes: 7 additions & 1 deletion R/vuongtest.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@
#' @importMethodsFrom lavaan coef fitted logLik vcov
#' @importFrom methods slotNames
#' @export
vuongtest <- function(object1, object2, nested=FALSE, adj="none", ll1=llcont, ll2=llcont, score1=NULL, score2=NULL, vc1=vcov, vc2=vcov) {
vuongtest <- function(object1, object2, nested=FALSE, adj=c("none", "aic", "bic"), ll1=llcont, ll2=llcont, score1=NULL, score2=NULL, vc1=vcov, vc2=vcov) {

## Input validation for security and robustness
if (!is.logical(nested) || length(nested) != 1) {
stop("Argument 'nested' must be a single logical value.")
}
Comment on lines +102 to +104
adj <- match.arg(adj)
Comment on lines +101 to +105

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