fix: fail closed on incomplete XGBoost analysis#1019
Conversation
Performance BenchmarksCompared
|
430aa83 to
446011e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 446011e676
ℹ️ 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".
| HEADER_FORMAT_TO_SCANNER_ID = _registry.get_header_format_to_scanner_ids() | ||
| _COMPRESSED_HEADER_FORMATS = frozenset({"compressed", "gzip", "bzip2", "xz", "lz4", "zlib"}) | ||
| _R_SERIALIZED_EXTENSIONS = frozenset({".rds", ".rda", ".rdata"}) | ||
| _XGBOOST_BINARY_EXTENSIONS = frozenset({".bst"}) |
There was a problem hiding this comment.
Include .model in XGBoost pickle-spoof fail-closed gate
_scan_file_internal() computes is_xgboost_pickle_spoof from _XGBOOST_BINARY_EXTENSIONS, but that set only contains .bst. .model is still treated as an XGBoost binary extension elsewhere, so a pickle renamed to .model bypasses the new spoof fail-closed path and is handled as a normal pickle scan instead of being marked inconclusive.
Useful? React with 👍 / 👎.
Summary
Fail closed when XGBoost analysis cannot complete because the model is malformed, the UBJ decoder is unavailable, or a
.bst/.modelfile is actually a pickle.Security impact
Previously, several XGBoost scanner paths emitted informational findings but still finished successfully: malformed JSON, missing UBJSON support, and pickle spoofing on binary model extensions. That let these evasions exit cleanly even though analysis was incomplete. This change adds explicit inconclusive metadata for those cases and finishes the scan as unsuccessful so the gate does not pass them as clean models.
Validation
uv run ruff format modelaudit/scanners/xgboost_scanner.py tests/scanners/test_xgboost_scanner.pyPROMPTFOO_DISABLE_TELEMETRY=1 uv run pytest tests/scanners/test_xgboost_scanner.py -quv run mypy modelaudit/scanners/xgboost_scanner.py tests/scanners/test_xgboost_scanner.py