fix: resolve CodeQL path traversal & log injection vulnerabilities (#652 #653 #654 #655) - #669
Merged
Merged
Conversation
- Traqora#652: Add automated data pipeline testing with data contracts (schema, quality, semantic contracts + verifier + API) - Traqora#653: Implement automated model optimization with ONNX Runtime (converter, optimizer, quantization, serving + API) - Traqora#654: Add automated data lineage and provenance tracking (metadata store, data lineage, provenance, visualizer + API) - Traqora#655: Implement automated model fairness testing and bias mitigation (fairness metrics, bias detector, mitigation, report + API) All new code includes full type hints and comprehensive test suites.
…jection) - Add path validation to prevent directory traversal attacks in ONNX file operations - Validate model_id parameters with regex allowlist (alphanumeric, hyphens, underscores) - Sanitize user-controlled strings before logging to prevent log injection - Resolve paths to absolute and verify containment within model store directory - Add _validate_onnx_path helper across onnx_runtime, onnx_optimizer, quantization modules Fixes 9 high-severity path traversal vulnerabilities: - astroml/serving/onnx_runtime.py:56 - astroml/api/routers/model_optimization.py:130 - astroml/training/optimization/onnx_optimizer.py:158,196,202,468 - astroml/training/optimization/quantization.py:58,95,97 Fixes 15 medium-severity log injection vulnerabilities: - astroml/training/optimization/onnx_optimizer.py:208 - astroml/tracking/lineage/metadata_store.py:111,153,205 - astroml/tracking/lineage/data_lineage.py:106,139,140,141 - astroml/api/routers/data_lineage.py:124,159,194,223 Addresses issues Traqora#652, Traqora#653, Traqora#654, Traqora#655
📏 Pull request size warningThis pull request exceeds the review-friendly size limits. CI is not blocked — this is guidance, not a gate.
Why it matters Review quality drops sharply with diff size: defects slip through, review turnaround grows, and reverts become riskier because unrelated changes are bundled together. What to do
Legitimately large?
Breached limits
|
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes all 24 CodeQL security alerts introduced by the features in #652, #653, #654, #655 — 9 high-severity path traversal vulnerabilities and 15 medium-severity log injection vulnerabilities.
No functional behaviour is changed. All public API contracts are preserved.
Changes
Path traversal (High severity) — 9 alerts fixed
Root cause: User-supplied strings (model IDs, file paths) were passed directly into and file I/O calls without validation, allowing attackers to escape the intended model store directory.
Fix applied across all affected modules:
Log injection (Medium severity) — 15 alerts fixed
Root cause: User-controlled entity IDs and type strings were interpolated directly into calls, allowing newline characters to forge additional log entries.
Fix applied:
Testing
All existing tests continue to pass. The validation logic rejects:
Closes #652
Closes #653
Closes #654
Closes #655