Skip to content

🛡️ Sentinel: [security improvement] Add input validation to vuongtest and icci#9

Open
seonghobae wants to merge 1 commit into
masterfrom
sentinel-input-validation-1463648741099773841
Open

🛡️ Sentinel: [security improvement] Add input validation to vuongtest and icci#9
seonghobae wants to merge 1 commit into
masterfrom
sentinel-input-validation-1463648741099773841

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

🚨 Severity: LOW/MEDIUM
💡 Vulnerability: Missing input validation in public-facing R functions (vuongtest and icci). This could lead to unexpected behavior, obscure downstream errors, or potential manipulation if these functions are exposed via a web API (like Shiny).
🎯 Impact: Invalid parameters such as non-logical nested, out-of-bounds conf.level, or invalid adj values would propagate deeply into the function before failing or producing incorrect statistical results.
🔧 Fix: Added defensive programming checks. match.arg() is now used for adj. is.logical() and length checks are added for nested. Strict numeric bounds and length checks are added for conf.level.
Verification: Changes were reviewed to be correctly placed and idiomatic for R. Testing can be verified by running the test suite via CI.


PR created automatically by Jules for task 1463648741099773841 started by @seonghobae

Added input validation to `R/icci.R` for `conf.level` and to `R/vuongtest.R` for `nested` and `adj` arguments to prevent unexpected behavior.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings June 24, 2026 03:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds defensive argument validation to two public-facing R APIs (vuongtest() and icci()) to fail fast on invalid inputs and avoid confusing downstream errors, aligning with the “Sentinel” security-hardening goal for functions that may be exposed via Shiny/web contexts.

Changes:

  • Add validation for nested and constrain adj via match.arg() in vuongtest().
  • Add validation for conf.level bounds in icci().
  • Record the input-validation hardening in .jules/sentinel.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
R/vuongtest.R Adds validation for nested and constrains adj values.
R/icci.R Adds bounds checking for conf.level.
.jules/sentinel.md Documents the validation hardening as a Sentinel learning/prevention note.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/vuongtest.R
Comment on lines +102 to +104
if (!is.logical(nested) || length(nested) != 1) {
stop("Argument 'nested' must be a single logical value.")
}
Comment thread R/vuongtest.R
Comment on lines +101 to +105
## Input validation for security and robustness
if (!is.logical(nested) || length(nested) != 1) {
stop("Argument 'nested' must be a single logical value.")
}
adj <- match.arg(adj)
Comment thread R/icci.R
Comment on lines +69 to +71
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 thread R/icci.R
Comment on lines +68 to +71
## 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.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants