-
Notifications
You must be signed in to change notification settings - Fork 0
π‘οΈ Sentinel: [MEDIUM] Fix integer coercion DoS vulnerability in readline #202
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
base: master
Are you sure you want to change the base?
Changes from all commits
7ad3034
dfeb9b3
6cf1270
f67f277
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,3 +22,4 @@ | |
| ^\.jules(/.*)?$ | ||
| ^\.trivyignore\.yaml$ | ||
| ^trivy\.yaml$ | ||
| ^\.semgrepignore$ | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,3 +35,46 @@ 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 integer validation works with strictly bounded regex", { | ||
| # Mock readline to return invalid inputs that should fail after 3 attempts | ||
| # override interactive() to TRUE to trigger the readline loop, then mock readline | ||
| with_mockery <- function() { | ||
| mockery::stub(aFIPC::autoFIPC, 'interactive', TRUE) | ||
| mockery::stub(aFIPC::autoFIPC, 'readline', mockery::mock('3', '0', '999999999')) | ||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = data.frame(A=1, B=2), | ||
| oldformYData = data.frame(A=1, B=2), | ||
| newformCommonItemNames = c('A', 'B'), | ||
| oldformCommonItemNames = c('A', 'B'), | ||
| confirmCommonItems = NULL | ||
| ), | ||
| "Too many invalid common item confirmation attempts" | ||
| ) | ||
| } | ||
| with_mockery() | ||
| }) | ||
|
|
||
| test_that("autoFIPC integer validation accepts valid inputs", { | ||
| # Mock readline to return '1' (valid input) | ||
| with_mockery_valid <- function() { | ||
| mockery::stub(aFIPC::autoFIPC, 'interactive', TRUE) | ||
| mockery::stub(aFIPC::autoFIPC, 'readline', '1') | ||
| mockery::stub(aFIPC::autoFIPC, 'mirt::mirt', function(...) stop('forced failure')) | ||
| mockery::stub(aFIPC::autoFIPC, 'surveyFA', function(...) stop('forced failure')) | ||
|
|
||
| expect_error( | ||
| aFIPC::autoFIPC( | ||
| newformXData = data.frame(A=1, B=2), | ||
| oldformYData = data.frame(A=1, B=2), | ||
| newformCommonItemNames = c('A', 'B'), | ||
| oldformCommonItemNames = c('A', 'B'), | ||
| confirmCommonItems = NULL, | ||
| oldformBILOGprior = NULL, | ||
| newformBILOGprior = NULL | ||
| ) | ||
| ) | ||
|
Comment on lines
+67
to
+77
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. π― Functional Correctness | π Major | β‘ Quick win π§© Analysis chainπ Script executed: #!/bin/bash
set -euo pipefail
# κ²μ¦ μ΄μ μ€λ₯μ κ²μ¦ μ΄ν μ€λ₯λ₯Ό ꡬλΆν μ μλμ§ νμΈν©λλ€.
rg -n -C 4 \
'expect_error\(|Common item confirmation requires|Initial estimation of oldFormModel' \
tests/testthat/test-sentinel-validation.R R/aFIPC.RRepository: ContextualWisdomLab/aFIPC Length of output: 4500 π Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- test block ---'
cat -n tests/testthat/test-sentinel-validation.R | sed -n '40,90p'
printf '%s\n' '--- autoFIPC control flow ---'
cat -n R/aFIPC.R | sed -n '100,250p'
printf '%s\n' '--- relevant test helpers and stubs ---'
rg -n -C 5 \
'mirt::mirt|surveyFA|confirmCommonItems|oldformBILOGprior|newformBILOGprior|expect_error' \
tests/testthat RRepository: ContextualWisdomLab/aFIPC Length of output: 50381 κΈ°λν μ€λ₯λ₯Ό λͺ μνμμμ€.
π€ Prompt for AI Agents |
||
| } | ||
| with_mockery_valid() | ||
| }) | ||
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.
π©Ί Stability & Availability | π Major | β‘ Quick win
π§© Analysis chain
π Script executed:
Repository: ContextualWisdomLab/aFIPC
Length of output: 2582
π Script executed:
Repository: ContextualWisdomLab/aFIPC
Length of output: 6784
π Script executed:
Repository: ContextualWisdomLab/aFIPC
Length of output: 9661
π Script executed:
Repository: ContextualWisdomLab/aFIPC
Length of output: 321
mockeryλ₯ΌSuggestsμ μΆκ°νμμμ€.νμ¬
DESCRIPTIONκ³Όpackrat/packrat.lockμmockeryκ° μμ΅λλ€. ν μ€νΈλmockery::stub()μmockery::mock()λ₯Ό μ§μ νΈμΆνλ―λ‘ κΉ¨λν νκ²½μR CMD checkμμ μ€ν¨ν©λλ€..github/workflows/r.ymlμ μμ‘΄μ± μ€μ μ΄ μ μΈλSuggestsν¨ν€μ§λ₯Ό μ€μΉν©λλ€. μ νμ μμ‘΄μ±μΌλ‘ μ μ§νλ €λ©΄skip_if_not_installed("mockery")λ₯Ό μΆκ°νμμμ€.π€ Prompt for AI Agents