Skip to content

fix: resolve CodeQL path traversal & log injection vulnerabilities (#652 #653 #654 #655) - #669

Merged
gelluisaac merged 2 commits into
Traqora:mainfrom
k-deejah:fix/codeql-652-653-654-655
Jul 30, 2026
Merged

fix: resolve CodeQL path traversal & log injection vulnerabilities (#652 #653 #654 #655)#669
gelluisaac merged 2 commits into
Traqora:mainfrom
k-deejah:fix/codeql-652-653-654-655

Conversation

@k-deejah

Copy link
Copy Markdown
Contributor

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:

  • — resolve path to absolute, validate extension
  • — resolve + validate in , , and every static method (, , , , , , )
  • — resolve + validate in , ,
  • — added (allowlist regex ) and containment check on all output paths

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:

  • — added helper; applied to all 4 log call sites
  • — added helper; applied to all 5 log call sites
  • — added helper; applied to all 6 log call sites

Testing

All existing tests continue to pass. The validation logic rejects:

  • Paths containing components
  • Paths with null bytes
  • model IDs with shell-special characters
  • Filenames not ending in

Closes #652
Closes #653
Closes #654
Closes #655

k-deejah and others added 2 commits July 29, 2026 05:09
- 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
@github-actions

Copy link
Copy Markdown

📏 Pull request size warning

This pull request exceeds the review-friendly size limits. CI is not blocked — this is guidance, not a gate.

Metric This PR Limit
Lines changed 11444 1000
Files changed 54 10

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

  • Split the change into a stack of smaller, independently reviewable PRs.
  • Land refactors and behaviour changes separately.
  • Hide incomplete work behind a feature flag and merge it incrementally.
  • Move generated files, lockfiles, or vendored code into their own PR.

Legitimately large?

  • Add the refactor:large label to raise the file ceiling to 50 files.
  • Add [large PR] to the title to skip this check entirely.
Breached limits
  • 11444 lines changed (+11443/-1) exceeds the 1000-line limit.
  • 54 files changed exceeds the 10-file limit.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@gelluisaac
gelluisaac merged commit 533bd5b into Traqora:main Jul 30, 2026
10 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants