Skip to content

fix(security): remediate failing image and dependency audits - #44

Merged
CoreyLeath-code merged 8 commits into
mainfrom
fix/security-dependency-remediation
Aug 6, 2026
Merged

fix(security): remediate failing image and dependency audits#44
CoreyLeath-code merged 8 commits into
mainfrom
fix/security-dependency-remediation

Conversation

@CoreyLeath-code

@CoreyLeath-code CoreyLeath-code commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the failing TrojanChat container-image, dependency-audit, Python CI, and benchmark-installation checks without weakening any required gate.

The failures had two verified causes:

  1. Released MLflow packages require cryptography<50, while the container scanner requires cryptography>=50.0.0 for CVE-2026-69247.
  2. After the application virtual environment was patched, Trivy still detected old msgpack and setuptools from the Python base image's package-management tooling—not from the app environment. CI verified the application venv contains msgpack 1.2.1, setuptools 83.0.0 during build, and cryptography 50.0.0.

Files changed

  • requirements.txt
    • Removes the unused, incompatible mlflow dependency.
    • Adds scanner-provided patched floors for cryptography, msgpack, and setuptools.
  • Dockerfile
    • Removes runtime pip, setuptools, wheel, and ensurepip payloads after the virtual environment is built. The container executes Uvicorn from /opt/venv and does not install packages at runtime.
  • .github/workflows/trojanchat-hygiene.yml
    • Preserves pip-audit.json with if: always(), including when the blocking audit fails.
  • ml/tracking/mlflow_utils.py
    • Removes the unreferenced MLflow tracking helper.
  • ml/experiments/prompt_eval.py
    • Removes a stale prompt experiment that imported a nonexistent log_chat_metrics helper and used a dummy API key.
  • ml/ml/experiments/prompt_eval.py
    • Removes the duplicate, unreferenced MLflow prompt experiment.

Validation performed

  • Inspected failed main Container Image Scan #86 and Dependency Audit #109.
  • Reproduced the MLflow resolver failure in Python CI, the dependency audit, the container build, and benchmark installation:
    mlflow 3.15.1 depends on cryptography<50 and >=43.0.0
    
  • Searched the repository for mlflow, MLflow, and mlflow_utils; no chat-backend runtime or README references exist outside the removed stale experiment paths.
  • On the intermediate PR commit, all hygiene checks passed after the stale dependency was removed: code hygiene, frontend build, Python 3.11, Python 3.12, and the blocking dependency audit.
  • Inspected the remaining image-scan result and confirmed the application venv was patched; the residual findings came from base-image package-management payloads.
  • The existing PR suite is running again on the runtime-image hardening change, including the container smoke test and container image scan.

Risks

The runtime image can no longer use pip/ensurepip to modify itself, which is intentional for an immutable production container. The repository no longer bundles the unreferenced MLflow experiment helpers. The supported chat backend, frontend, and documented installation path are unaffected.

Follow-up recommendations

  • Keep the security and dependency-audit checks required.
  • Review the retained pip-audit.json artifact whenever the audit fails.
  • Reintroduce telemetry only with a maintained, compatible dependency and dedicated tests.

Summary by CodeRabbit

  • Security
    • Strengthened runtime image hardening by removing package-management and installer tooling.
    • Added minimum secure versions for key transitive dependencies.
  • Bug Fixes
    • Dependency-audit reports are now uploaded even when the audit detects failures.
  • Cleanup
    • Removed unused prompt experimentation and experiment-tracking capabilities.
    • Removed the MLflow dependency.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 40e6aa52-181a-4fd7-bca7-e66a7fac7d89

📥 Commits

Reviewing files that changed from the base of the PR and between f960b2e and 9c40be0.

📒 Files selected for processing (6)
  • .github/workflows/trojanchat-hygiene.yml
  • Dockerfile
  • ml/experiments/prompt_eval.py
  • ml/ml/experiments/prompt_eval.py
  • ml/tracking/mlflow_utils.py
  • requirements.txt

📝 Walkthrough

Walkthrough

The pull request removes MLflow experiment and tracking modules, updates dependency security floors, removes package-management tooling from the runtime image, and preserves dependency-audit report uploads after audit failures.

Changes

Security and hygiene updates

Layer / File(s) Summary
MLflow experiment and tracking removal
ml/experiments/prompt_eval.py, ml/ml/experiments/prompt_eval.py, ml/tracking/mlflow_utils.py
Deletes prompt experiment workflows and MLflow run, metric, and parameter helpers.
Runtime and dependency hardening
Dockerfile, requirements.txt
Removes MLflow and adds minimum versions for cryptography, msgpack, and setuptools. The runtime image removes pip, setuptools, wheel, and ensurepip.
Audit report retention
.github/workflows/trojanchat-hygiene.yml
Configures dependency-audit report upload to run even when the audit command fails.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/security-dependency-remediation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@CoreyLeath-code
CoreyLeath-code marked this pull request as ready for review August 6, 2026 15:23
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@CoreyLeath-code
CoreyLeath-code merged commit b842045 into main Aug 6, 2026
20 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

Development

Successfully merging this pull request may close these issues.

1 participant