Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
18e6493
🛡️ Sentinel: [MEDIUM] Add input validation to exported functions to f…
seonghobae Aug 28, 2026
306b35d
🛡️ Sentinel: [MEDIUM] Add input validation to exported functions to f…
seonghobae Aug 28, 2026
344f3f0
🛡️ Sentinel: [MEDIUM] Add input validation to exported functions to f…
seonghobae Aug 28, 2026
37a3e14
🛡️ Sentinel: [MEDIUM] Add input validation to exported functions to f…
seonghobae Aug 28, 2026
175a5a3
🛡️ Sentinel: [MEDIUM] Add input validation to exported functions to f…
seonghobae Aug 28, 2026
9b671ba
🛡️ Sentinel: [MEDIUM] Add input validation to exported functions to f…
seonghobae Aug 28, 2026
8de9b1d
Fix input validation in vuongtest and icci
seonghobae Sep 6, 2026
b974c46
Fix input validation in vuongtest and icci
seonghobae Sep 6, 2026
1b4c224
chore: restore protected Sentinel doctrine
seonghobae Sep 6, 2026
d1e7593
test(api): lock exported option validation contracts
seonghobae Sep 6, 2026
efca0b8
Fix input validation in vuongtest and icci
seonghobae Sep 6, 2026
76bb9ab
Fix input validation in vuongtest and icci
seonghobae Sep 6, 2026
dcf2c1c
repair: restore canonical Sentinel doctrine
seonghobae Sep 6, 2026
f76cc95
test: restore exported input validation regression
seonghobae Sep 6, 2026
d10ed86
Fix input validation in vuongtest and icci
seonghobae Sep 6, 2026
14be33f
repair(validation): restore exported input contract evidence
seonghobae Sep 6, 2026
4af1981
test(validation): preserve edge-case error contract
seonghobae Sep 6, 2026
6e68c37
test(validation): inherit zero-length and non-finite controls
seonghobae Sep 6, 2026
5a4be4c
merge(validation): preserve #108 history under canonical option contract
seonghobae Sep 7, 2026
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 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) {

## Security validation for inputs
if (length(conf.level) != 1 || !is.numeric(conf.level) || is.na(conf.level) || conf.level <= 0 || conf.level >= 1) {
stop("Argument 'conf.level' must be a single numeric value between 0 and 1.", call. = FALSE)
}

## check objects, issue warnings/errors, get classes/calls
obinfo <- check.obj(object1, object2)
callA <- obinfo$callA; classA <- obinfo$classA
Expand Down
8 changes: 8 additions & 0 deletions R/vuongtest.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@
#' @export
vuongtest <- function(object1, object2, nested=FALSE, adj="none", ll1=llcont, ll2=llcont, score1=NULL, score2=NULL, vc1=vcov, vc2=vcov) {

## Security validation for inputs
if (length(nested) != 1 || !is.logical(nested) || is.na(nested)) {
stop("Argument 'nested' must be a single logical value (TRUE/FALSE).", call. = FALSE)
}
if (length(adj) != 1 || !is.character(adj) || is.na(adj) || !(adj %in% c("none", "aic", "bic"))) {
stop("Argument 'adj' must be a single character string ('none', 'aic', or 'bic').", call. = FALSE)
}

## check objects, issue warnings/errors, get classes/calls
obinfo <- check.obj(object1, object2)
callA <- obinfo$callA; classA <- obinfo$classA
Expand Down
34 changes: 34 additions & 0 deletions tests/testthat/test_exported_input_validation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
expect_exported_boundary_error <- function(expr, message) {
err <- tryCatch(expr, error = identity)
expect_s3_class(err, "error")
expect_identical(conditionMessage(err), message)
expect_null(conditionCall(err))
}

test_that("vuongtest validates option arguments at the exported boundary", {
nested_message <- "Argument 'nested' must be a single logical value (TRUE/FALSE)."
for (value in list(logical(), NA, c(TRUE, FALSE), 1, "yes", NULL)) {
expect_exported_boundary_error(
vuongtest(NULL, NULL, nested = value),
nested_message
)
}

adj_message <- "Argument 'adj' must be a single character string ('none', 'aic', or 'bic')."
for (value in list(character(), NA_character_, c("none", "aic"), "AIC", "", "aic ", "other", 1, NULL)) {
expect_exported_boundary_error(
vuongtest(NULL, NULL, adj = value),
adj_message
)
}
})

test_that("icci validates confidence levels at the exported boundary", {
conf_message <- "Argument 'conf.level' must be a single numeric value between 0 and 1."
for (value in list(numeric(), NA_real_, NaN, Inf, -Inf, c(0.9, 0.95), 0, 1, -0.1, 1.1, "0.95", NULL)) {
expect_exported_boundary_error(
icci(NULL, NULL, conf.level = value),
conf_message
)
}
})
Loading