fix: harden pickle nested bypass detection#1027
Conversation
Performance BenchmarksCompared Top regressions:
Top improvements:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8789a88bb7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if limit_exceeded { | ||
| self.record_nested_probe_limit_exceeded("raw", value.len(), position); | ||
| } |
There was a problem hiding this comment.
Only raise probe-limit when skipped offsets remain
limit_exceeded is computed before skip_offsets_before filtering, then always emitted here. If offset 0 is a valid full nested pickle, many inner bytes can still count as prefix candidates (e.g., repeated 0x80 0x04 inside string data), trip the 64-offset cap, and force an inconclusive critical result even though all relevant bytes were already covered by the parsed payload.
Useful? React with 👍 / 👎.
Summary
Security fixes
Validation
uv run --with maturin maturin develop --manifest-path packages/modelaudit-picklescan/Cargo.tomlcargo test --manifest-path packages/modelaudit-picklescan/Cargo.tomlPROMPTFOO_DISABLE_TELEMETRY=1 uv run pytest packages/modelaudit-picklescan/tests/test_rust_engine.py packages/modelaudit-picklescan/tests/test_adversarial_pickle_oracle.py tests/scanners/test_pickle_scanner.py tests/scanners/test_picklescan_adapter.py -quv run ruff check --fix modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/uv run ruff format --check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/uv run mypy modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/PROMPTFOO_DISABLE_TELEMETRY=1 uv run pytest -n auto -m "not slow and not integration" --maxfail=1git diff --check