-
Notifications
You must be signed in to change notification settings - Fork 0
fix(input): restrict interactive binary choices to 1 or 2 #325
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
Draft
seonghobae
wants to merge
7
commits into
master
Choose a base branch
from
sentinel-fix-integer-coercion-9946297038343241186
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0c88908
🛡️ Sentinel: 입력값 검증 강화를 통한 정수 오버플로 취약점 해결
seonghobae e31ed6e
🛡️ Sentinel: 입력값 검증 강화를 통한 정수 오버플로 취약점 해결
seonghobae d1732bb
🛡️ Sentinel: 입력값 검증 강화를 통한 정수 오버플로 취약점 해결
seonghobae f3da093
🛡️ Sentinel: 입력값 검증 강화를 통한 정수 오버플로 취약점 해결
seonghobae ed9f9c5
repair(test): keep prompt regression in package checks
seonghobae 190f8d5
repair(quality): remove unrelated markdownlint override
seonghobae 14767a8
repair(security): remove overgeneralized integer-overflow doctrine
seonghobae 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| test_that("interactive readline valid inputs", { | ||
| # For valid inputs, it should correctly parse the '1' and eventually hit the estimation | ||
| # We test the prompt reading by providing minimal data that causes mirt to fail early | ||
| # but after the prompt logic. | ||
|
|
||
| mock_readline_confirm <- mockery::mock('1') | ||
| mockery::stub(aFIPC::autoFIPC, 'interactive', TRUE) | ||
| mockery::stub(aFIPC::autoFIPC, 'readline', mock_readline_confirm) | ||
|
|
||
| # A 100x4 matrix works better to avoid degrees of freedom errors in some cases, | ||
| # but our goal is just to pass the `checkCorrect()` prompt logic. | ||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = matrix(sample(c(0,1), 1000, replace=T), ncol=10, dimnames=list(NULL, paste0('I',1:10))), | ||
| oldformYData = matrix(sample(c(0,1), 1000, replace=T), ncol=10, dimnames=list(NULL, paste0('I',1:10))), | ||
| newformCommonItemNames = 'I1', | ||
| oldformCommonItemNames = 'I1', | ||
| itemtype = '3PL', | ||
| newformBILOGprior = TRUE, | ||
| oldformBILOGprior = TRUE, | ||
| confirmCommonItems = NULL | ||
| ) | ||
| ) | ||
|
Comment on lines
+12
to
+23
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. |
||
| }) | ||
|
|
||
| test_that("interactive readline invalid inputs", { | ||
| # Mock invalid inputs | ||
| mock_readline_invalid <- mockery::mock('3', 'a', '9999999999999999999999999999999', cycle = TRUE) | ||
| mockery::stub(aFIPC::autoFIPC, 'interactive', TRUE) | ||
| mockery::stub(aFIPC::autoFIPC, 'readline', mock_readline_invalid) | ||
|
|
||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = matrix(sample(c(0,1), 1000, replace=T), ncol=10, dimnames=list(NULL, paste0('I',1:10))), | ||
| oldformYData = matrix(sample(c(0,1), 1000, replace=T), ncol=10, dimnames=list(NULL, paste0('I',1:10))), | ||
| newformCommonItemNames = 'I1', | ||
| oldformCommonItemNames = 'I1', | ||
| itemtype = '3PL', | ||
| newformBILOGprior = NULL, | ||
| oldformBILOGprior = TRUE, | ||
| confirmCommonItems = TRUE | ||
| ), | ||
| "Too many invalid newform BILOG prior attempts" | ||
| ) | ||
|
|
||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = matrix(sample(c(0,1), 1000, replace=T), ncol=10, dimnames=list(NULL, paste0('I',1:10))), | ||
| oldformYData = matrix(sample(c(0,1), 1000, replace=T), ncol=10, dimnames=list(NULL, paste0('I',1:10))), | ||
| newformCommonItemNames = 'I1', | ||
| oldformCommonItemNames = 'I1', | ||
| itemtype = '3PL', | ||
| newformBILOGprior = TRUE, | ||
| oldformBILOGprior = NULL, | ||
| confirmCommonItems = TRUE | ||
| ), | ||
| "Too many invalid oldform BILOG prior attempts" | ||
| ) | ||
|
|
||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = matrix(sample(c(0,1), 1000, replace=T), ncol=10, dimnames=list(NULL, paste0('I',1:10))), | ||
| oldformYData = matrix(sample(c(0,1), 1000, replace=T), ncol=10, dimnames=list(NULL, paste0('I',1:10))), | ||
| newformCommonItemNames = 'I1', | ||
| oldformCommonItemNames = 'I1', | ||
| itemtype = '3PL', | ||
| newformBILOGprior = TRUE, | ||
| oldformBILOGprior = TRUE, | ||
| confirmCommonItems = NULL | ||
| ), | ||
| "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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
성공 경로를 명시적으로 검증하십시오.
Line 12의
expect_error()는 모든 오류를 허용합니다.1이 거부되어"Too many invalid common item confirmation attempts"오류가 발생해도 이 테스트는 통과합니다.checkCorrect()가1L을 반환한 뒤에만 도달할 수 있는 센티널 또는 결정적 후속 결과를 검증하십시오.🤖 Prompt for AI Agents
Source: Coding guidelines