-
Notifications
You must be signed in to change notification settings - Fork 0
π‘οΈ Sentinel: [CRITICAL] Fix integer coercion DoS vulnerability #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
seonghobae
wants to merge
2
commits into
master
from
sentinel/fix-integer-coercion-dos-13376868277628728633
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,3 +35,72 @@ test_that("autoFIPC validates boolean flags for newformBILOGprior, oldformBILOGp | |
| "Security Error: confirmCommonItems must be a single non-NA logical value or NULL" | ||
| ) | ||
| }) | ||
|
|
||
| test_that("autoFIPC interactive prompts prevent NA coercion crashes and DoS vulnerabilities from large integer inputs", { | ||
|
|
||
| # verify oldformBILOGprior validation protects against large integer inputs | ||
|
|
||
| mockery::stub(aFIPC::autoFIPC, 'interactive', function(...) TRUE) | ||
| mockery::stub(aFIPC::autoFIPC, 'readline', function(...) "9999999999") | ||
|
|
||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = data.frame(A=1), | ||
| oldformYData = data.frame(A=2), | ||
| newformCommonItemNames = c('A'), | ||
| oldformCommonItemNames = c('A'), | ||
| confirmCommonItems = TRUE, | ||
| itemtype = '3PL', | ||
| tryFitwholeNewItems = FALSE, | ||
| tryFitwholeOldItems = FALSE, | ||
| checkIPD = FALSE | ||
| ), | ||
| "Too many invalid oldform BILOG prior attempts" | ||
| ) | ||
|
|
||
| # verify newformBILOGprior validation protects against large integer inputs | ||
| mockery::stub(aFIPC::autoFIPC, 'interactive', function(...) TRUE) | ||
| mockery::stub(aFIPC::autoFIPC, 'readline', function(...) "9999999999") | ||
|
|
||
| # We need oldformYData to be a model or at least have multiple categories so it bypasses failure during mirt fitting, | ||
| # or we can mock mirt::mirt so it returns a dummy model to reach newformBILOGprior check. | ||
| mod <- new("SingleGroupClass") | ||
| mod@OptimInfo$converged <- TRUE | ||
| mod@OptimInfo$secondordertest <- TRUE | ||
| mod@Data$data <- data.frame(A=c(1,0)) | ||
| mockery::stub(aFIPC::autoFIPC, 'mirt::mirt', function(...) mod) | ||
|
Comment on lines
+67
to
+71
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This case does not reach
#249 reaches this prompt by passing a fitted 2PL |
||
| mockery::stub(aFIPC::autoFIPC, 'surveyFA', function(...) mod) | ||
|
|
||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = data.frame(A=1), | ||
| oldformYData = data.frame(A=c(1,0)), | ||
| newformCommonItemNames = c('A'), | ||
| oldformCommonItemNames = c('A'), | ||
| confirmCommonItems = TRUE, | ||
| oldformBILOGprior = TRUE, | ||
| itemtype = '3PL', | ||
| tryFitwholeNewItems = FALSE, | ||
| tryFitwholeOldItems = FALSE, | ||
| checkIPD = FALSE | ||
| ), | ||
| "Too many invalid newform BILOG prior attempts" | ||
| ) | ||
|
|
||
| # verify confirmCommonItems validation protects against large integer inputs | ||
| mockery::stub(aFIPC::autoFIPC, 'interactive', function(...) TRUE) | ||
| mockery::stub(aFIPC::autoFIPC, 'readline', function(...) "9999999999") | ||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = data.frame(A=1), | ||
| oldformYData = data.frame(A=2), | ||
| newformCommonItemNames = c('A'), | ||
| oldformCommonItemNames = c('A'), | ||
| itemtype = '3PL', | ||
| tryFitwholeNewItems = FALSE, | ||
| tryFitwholeOldItems = FALSE, | ||
| checkIPD = FALSE | ||
| ), | ||
| "Too many invalid common item confirmation attempts" | ||
| ) | ||
| }) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mockeryis not inDESCRIPTIONSuggests (onlytestthat >= 3.0.0). R CMD check will fail onmockery::stubunless the runner happens to have a leftover install. Do not addmockeryfor this slice β #249 already mocksinteractive/readlinewithtestthat::local_mocked_bindings(..., .package = "aFIPC")after adding NULL namespace bindings.