Skip to content

๐Ÿ›ก๏ธ Sentinel: [MEDIUM] Fix input validation missing on exported functions - #85

Closed
seonghobae wants to merge 1 commit into
masterfrom
sentinel-input-validation-3185216319467007046
Closed

๐Ÿ›ก๏ธ Sentinel: [MEDIUM] Fix input validation missing on exported functions#85
seonghobae wants to merge 1 commit into
masterfrom
sentinel-input-validation-3185216319467007046

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

๐Ÿšจ Severity: MEDIUM
๐Ÿ’ก Vulnerability: Missing input validation on exported functions icci and vuongtest.
๐ŸŽฏ Impact: Invalid inputs like non-numerics or missing arguments trigger unhandled base R errors (e.g. non-numeric argument to binary operator or missing value where TRUE/FALSE needed) deep within the internal logic, potentially leaking execution stack or state information.
๐Ÿ”ง Fix: Added strict type and bound checks for conf.level and nested at the very beginning of the functions. These check failure conditions and securely halt execution using stop(..., call. = FALSE).
โœ… Verification: Verified that tests pass via R CMD INSTALL . and testthat script runs without error. Tested invalid inputs manually to verify they result in clean generic errors.


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

Summary by CodeRabbit

  • ๋ฒ„๊ทธ ์ˆ˜์ •

    • icci()์—์„œ ์‹ ๋ขฐ์ˆ˜์ค€์ด 0๊ณผ 1 ์‚ฌ์ด์˜ ๋‹จ์ผ ์ˆซ์ž์ธ์ง€ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.
    • vuongtest()์—์„œ nested๊ฐ€ ์œ ํšจํ•œ ๋‹จ์ผ ๋…ผ๋ฆฌ๊ฐ’์ธ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
    • ์ž˜๋ชป๋œ ์ž…๋ ฅ์—๋Š” ์•ˆ์ „ํ•˜๊ณ  ๋ช…ํ™•ํ•œ ์˜ค๋ฅ˜๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
  • ๋ฌธ์„œ

    • ํ•จ์ˆ˜ ์ž…๋ ฅ๊ฐ’ ๊ฒ€์ฆ ๊ธฐ์ค€๊ณผ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ ์ง€์นจ์„ ๋ณด์™„ํ–ˆ์Šต๋‹ˆ๋‹ค.

- Added validation for `conf.level` in `icci`
- Added validation for `nested` in `vuongtest`
- Ensures inputs fail securely with `call. = FALSE` before causing low-level R errors.
@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.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

๐Ÿ“ Walkthrough

Walkthrough

icci()๋Š” conf.level์˜ ํ˜•์‹๊ณผ ๋ฒ”์œ„๋ฅผ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค. vuongtest()๋Š” nested๊ฐ€ ๋‹จ์ผ ๋…ผ๋ฆฌ๊ฐ’์ธ์ง€ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค. ๊ด€๋ จ ๋ณด์•ˆ ์ง€์นจ์€ ๊ฒ€์ฆ ์‹คํŒจ ์‹œ call. = FALSE๋กœ ์˜ค๋ฅ˜๋ฅผ ์ฒ˜๋ฆฌํ•˜๋„๋ก ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค.

Changes

์ž…๋ ฅ ๊ฒ€์ฆ

Layer / File(s) Summary
์ž…๋ ฅ ๊ฒ€์ฆ ๋ฐ ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ
.jules/sentinel.md, R/icci.R, R/vuongtest.R
icci()๋Š” ์œ ํšจํ•œ ๋‹จ์ผ ์ˆซ์ž์ธ conf.level๋งŒ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. vuongtest()๋Š” ๋‹จ์ผ ๋…ผ๋ฆฌ๊ฐ’์ธ nested๋งŒ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. ์œ ํšจํ•˜์ง€ ์•Š์€ ์ž…๋ ฅ์€ ์˜ค๋ฅ˜๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. ๋ณด์•ˆ ์ง€์นจ์€ call. = FALSE ์‚ฌ์šฉ์„ ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: โšช Minimal ยท up to bde98

The PR adds localized input validation for the exported functions, and no actionable merge-blocking risk remains after normal checks and review.

๐Ÿšฅ Pre-merge checks | โœ… 5
โœ… Passed checks (5 passed)
Check name Status Explanation
Description Check โœ… Passed Check skipped - CodeRabbitโ€™s high-level summary is enabled.
Title check โœ… Passed ์ œ๋ชฉ์€ ๋‚ด๋ณด๋‚ธ ํ•จ์ˆ˜์˜ ์ž…๋ ฅ ๊ฒ€์ฆ ์ถ”๊ฐ€๋ผ๋Š” ๋ณ€๊ฒฝ์˜ ์ฃผ์š” ๋‚ด์šฉ์„ ์ •ํ™•ํ•˜๊ณ  ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check โœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check โœ… Passed Check skipped because no linked issues were found for this pull request.
โœจ Finishing Touches
๐Ÿงช Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-input-validation-3185216319467007046

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

๐Ÿงน Nitpick comments (1)
R/icci.R (1)

67-69: ๐ŸŽฏ Functional Correctness | ๐Ÿ”ต Trivial | โšก Quick win

์ƒˆ ์ž…๋ ฅ ๊ฒ€์ฆ์„ ์ž๋™ ํšŒ๊ท€ ํ…Œ์ŠคํŠธ๋กœ ๊ณ ์ •ํ•˜์„ธ์š”.

  • R/icci.R#L67-L69: conf.level์˜ NA, ๊ฒฝ๊ณ„๊ฐ’, ์ž˜๋ชป๋œ ๊ธธ์ด, ์ž˜๋ชป๋œ ํƒ€์ž…๊ณผ conditionCall(err) == NULL์„ ๊ฒ€์ฆํ•˜์„ธ์š”.
  • R/vuongtest.R#L100-L102: nested์˜ NA, ์ž˜๋ชป๋œ ๊ธธ์ด, ์ž˜๋ชป๋œ ํƒ€์ž…๊ณผ conditionCall(err) == NULL์„ ๊ฒ€์ฆํ•˜์„ธ์š”.
๐Ÿค– 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, R/icci.R 67-69์˜ conf.level ๊ฒ€์ฆ์— ๋Œ€ํ•œ ์ž๋™ ํšŒ๊ท€ ํ…Œ์ŠคํŠธ๋ฅผ
์ถ”๊ฐ€ํ•ด NA, 0ยท1 ๊ฒฝ๊ณ„๊ฐ’, ์ž˜๋ชป๋œ ๊ธธ์ด์™€ ํƒ€์ž…์ด ์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๊ณ  conditionCall(err) == NULL์ธ์ง€ ํ™•์ธํ•˜์„ธ์š”.
R/vuongtest.R 100-102์˜ nested ๊ฒ€์ฆ์—๋„ NA, ์ž˜๋ชป๋œ ๊ธธ์ด์™€ ํƒ€์ž…์„ ํ…Œ์ŠคํŠธํ•˜๊ณ  ๋™์ผํ•˜๊ฒŒ conditionCall(err)
== NULL์„ ๊ฒ€์ฆํ•˜์„ธ์š”.
๐Ÿค– Prompt for all review comments with 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.

Inline comments:
In `@R/icci.R`:
- Around line 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.

---

Nitpick comments:
In `@R/icci.R`:
- Around line 67-69: R/icci.R 67-69์˜ conf.level ๊ฒ€์ฆ์— ๋Œ€ํ•œ ์ž๋™ ํšŒ๊ท€ ํ…Œ์ŠคํŠธ๋ฅผ ์ถ”๊ฐ€ํ•ด NA, 0ยท1
๊ฒฝ๊ณ„๊ฐ’, ์ž˜๋ชป๋œ ๊ธธ์ด์™€ ํƒ€์ž…์ด ์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๊ณ  conditionCall(err) == NULL์ธ์ง€ ํ™•์ธํ•˜์„ธ์š”. R/vuongtest.R
100-102์˜ nested ๊ฒ€์ฆ์—๋„ NA, ์ž˜๋ชป๋œ ๊ธธ์ด์™€ ํƒ€์ž…์„ ํ…Œ์ŠคํŠธํ•˜๊ณ  ๋™์ผํ•˜๊ฒŒ conditionCall(err) == NULL์„
๊ฒ€์ฆํ•˜์„ธ์š”.
๐Ÿช„ Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

โ„น๏ธ Review info
โš™๏ธ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f85228d-a56d-46ab-addf-d5e791c15a1f

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 807e940 and bde9874.

๐Ÿ“’ Files selected for processing (3)
  • .jules/sentinel.md
  • R/icci.R
  • R/vuongtest.R

Comment thread R/icci.R
Comment on lines +67 to +69
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)
}

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.

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #84. PR #84 implements the same icci() and vuongtest() exported-boundary validation, and additionally validates adj, rejects zero-length/non-finite inputs, asserts call-free package-owned errors across a regression matrix, and carries the security-history update. Keeping one canonical implementation avoids divergent error contracts and duplicate CI/review work.

@seonghobae seonghobae closed this Aug 15, 2026
@google-labs-jules

Copy link
Copy Markdown

Closing as superseded by #84. PR #84 implements the same icci() and vuongtest() exported-boundary validation, and additionally validates adj, rejects zero-length/non-finite inputs, asserts call-free package-owned errors across a regression matrix, and carries the security-history update. Keeping one canonical implementation avoids divergent error contracts and duplicate CI/review work.

Understood. Acknowledging that this PR is superseded by #84 and stopping work on this task.

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.

1 participant