Skip to content

Security: Remediate 5 CVEs in Python Dependencies #544

Closed

Description

@mrveiss

Objective

Update Python dependencies to fix 5 known CVEs identified by pip-audit.

Priority

High - Security vulnerabilities should be addressed promptly.

CVE Summary

Package Current Version CVE Severity Fixed Version Description
ansible 10.7.0 CVE-2025-14010 Medium 12.2.0 Information exposure of credentials via verbose output
authlib 1.6.1 CVE-2025-59420 Medium 1.6.4 JWS verification accepts unknown critical headers
authlib 1.6.1 CVE-2025-61920 High 1.6.5 Unbounded JWS/JWT header DoS
authlib 1.6.1 CVE-2025-62706 Medium 1.6.5 JWE zip=DEF decompression bomb DoS
filelock 3.16.1 CVE-2025-68146 High 3.20.1 TOCTOU race condition symlink attack
keras 3.11.0 CVE-2025-9905 High 3.11.3 .h5 model loading ignores safe_mode=True

Tasks

1. Update Dependencies

  • Update ansible from 10.7.0 to 12.2.0+
  • Update authlib from 1.6.1 to 1.6.5+
  • Update filelock from 3.16.1 to 3.20.1+
  • Update keras from 3.11.0 to 3.11.3+

2. Verify Compatibility

  • Run full test suite after updates
  • Check for breaking changes in major version bumps (ansible 10→12)
  • Verify virtualenv/poetry still work (depend on filelock)
  • Verify ML pipelines work (depend on keras)

3. Update Requirements Files

  • Update requirements.txt
  • Update any pinned versions in pyproject.toml if applicable
  • Regenerate lock files if used

4. Validation

  • Run pip-audit to confirm all CVEs resolved
  • Run security tests
  • Test affected functionality

Risk Assessment

Package Risk of Breaking Changes Mitigation
ansible High (major version) Test automation scripts thoroughly
authlib Low (patch version) Test JWT/OAuth flows
filelock Low (patch version) Test file locking operations
keras Low (patch version) Test model loading

Commands

# Check current vulnerabilities
pip-audit

# Update packages
pip install --upgrade ansible>=12.2.0 authlib>=1.6.5 filelock>=3.20.1 keras>=3.11.3

# Verify fix
pip-audit

Related

Labels

security, dependencies, backend

Activity

  1. mrveiss commented on Dec 31, 2025

    @mrveiss
    OwnerAuthor

    Starting work on this security issue. Will update dependencies to fix the 5 CVEs identified by pip-audit.

    Packages to update:

  2. mrveiss commented on Dec 31, 2025

    @mrveiss
    OwnerAuthor

    Scope Change: Infrastructure-Based Dependency Management

    After analysis, the approach needs to change from direct pip upgrades to a proper Ansible-based patch management system similar to oVirt's architecture.

    Why This Matters:

    • All services run in virtual environments across 5 VMs
    • Direct pip upgrades could disrupt running services
    • Need rolling updates with health checks
    • Future expansion (new workers, services) needs standardized provisioning

    New Approach:

    1. Ansible playbooks for dependency patching (non-disruptive)
    2. Rolling update strategy - one VM at a time with health verification
    3. Standardized provisioning for adding new workers/services (oVirt-style)
    4. Inventory management for all VMs and services

    Requirements Files Updated:

    • ✅ config/requirements.txt - starlette, pypdf, markdownify versions bumped
    • ✅ config/requirements-ci.txt - same updates
    • ✅ requirements.txt - pypdf version bumped
    • ✅ requirements-ci.txt - same updates

    Next Steps:

    Creating new issue for Ansible infrastructure management system, then linking back to complete this CVE remediation properly.

  3. mrveiss commented on Dec 31, 2025

    @mrveiss
    OwnerAuthor

    Progress Update

    Requirements Files Updated ✅

    The following requirements files have been updated with security fixes:

    • config/requirements.txt - starlette ≥0.49.1, pypdf ≥6.4.0, markdownify ≥0.14.1
    • config/requirements-ci.txt - same updates
    • requirements.txt - pypdf ≥6.4.0
    • requirements-ci.txt - same updates

    Infrastructure Issue Created

    Created #682 for implementing the Ansible-based rolling update system. This provides:

    • Non-disruptive updates - One VM at a time with health verification
    • Automatic rollback - Restore from backup on failure
    • oVirt-style patterns - Maintenance mode, drain, health checks
    • Future-proof - Reusable for all dependency updates

    Blocking Dependency

    This issue is now blocked by #682 - once the Ansible rolling update system is in place, the actual CVE remediation can be executed safely across all VMs.

    Actual CVEs in venv (pip-audit results)

    filelock       3.18.0  → 3.20.1+
    keras          3.11.2  → 3.12.0+
    langchain-core 0.3.74  → 0.3.81+
    markdownify    0.11.6  → 0.14.1+
    marshmallow    3.26.1  → 3.26.2+
    pypdf          5.9.0   → 6.4.0+
    starlette      0.47.2  → 0.49.1+
    urllib3        2.5.0   → 2.6.0+
    werkzeug       3.1.3   → 3.1.4+
    requests       2.31.0  → 2.32.4+
    

    Note: ansible and authlib from the original issue are NOT installed in the AutoBot venv - they were detected in the system Python.

  4. mrveiss commented on Dec 31, 2025

    @mrveiss
    OwnerAuthor

    Infrastructure Ready ✅

    The Ansible rolling update system (#682) has been implemented and committed (b80ff577).

    Requirements Files Updated

    • config/requirements.txt - starlette ≥0.49.1, pypdf ≥6.4.0, markdownify ≥0.14.1
    • config/requirements-ci.txt - Same updates
    • requirements.txt, requirements-ci.txt - pypdf ≥6.4.0

    Next Step: Apply Updates

    Once ready to remediate the CVEs, run:

    # Preview changes first
    ./ansible/deploy.sh --patch-dependencies-check
    
    # Apply rolling updates
    ./ansible/deploy.sh --patch-dependencies

    CVEs to be Fixed

    The rolling update system will patch:

    Rollback Available

    If any issues occur during patching:

    ./ansible/deploy.sh --rollback-dependencies

    This issue remains open until the actual patching is executed and verified with pip-audit.

  5. mrveiss commented on Dec 31, 2025

    @mrveiss
    OwnerAuthor

    Starting GUI-Based Update Implementation

    Based on discussion, extending this issue to include GUI-triggerable package updates via Ansible (similar to oVirt approach).

    Implementation Plan:

    1. Ansible Playbook - ansible/playbooks/update-packages.yml to update Python packages with CVE fixes
    2. Celery Task - backend/tasks/deployment_tasks.py - async task for running update playbook
    3. API Endpoints - backend/api/settings.py - endpoints for triggering and monitoring updates
    4. Settings UI - System Updates section in User Management Settings

    Target Packages (from CVE analysis):

    Work starting now...

  6. mrveiss commented on Dec 31, 2025

    @mrveiss
    OwnerAuthor

    Implementation Complete ✅

    GUI-Based System Updates Feature (oVirt-style)

    Successfully implemented GUI-triggerable package updates via Ansible, similar to oVirt's approach.

    Changes Made:

    Backend - Celery Tasks (backend/tasks/deployment_tasks.py):

    • Added run_system_update task for Python deps and system packages
    • Added check_available_updates task for pip-audit + apt check
    • Real-time progress via Celery state updates
    • Support for dry run mode and force update options

    Backend - API Endpoints (backend/api/settings.py):

    • POST /api/settings/updates/run - Trigger system updates
    • GET /api/settings/updates/status/{task_id} - Poll task progress
    • POST /api/settings/updates/check - Check for available updates
    • GET /api/settings/updates/status - Get last update info
    • All endpoints require admin:access permission

    Frontend - Settings UI (UserManagementSettings.vue):

    • New "System Updates" section visible to admins
    • "Check for Updates" button with live progress
    • "Run Updates" modal with options:
      • Update type: Python Dependencies / System Packages
      • Dry Run mode
      • Force Update option
    • Real-time progress display during updates
    • Polling timeout protection (5 min for updates, 1 min for checks)

    Existing Ansible Playbooks Utilized:

    • patch-dependencies.yml - Rolling Python dependency updates
    • patch-system-packages.yml - System package updates
    • dependency_patching role with backup/rollback support

    Code Review Fixes Applied:

    • Fixed type annotation (list | None instead of list = None)
    • Added polling timeout to pollUpdateCheckStatus
    • Added admin guard to runSystemUpdate
    • Moved imports to module level

    Location in UI:

    Settings → User Management → System Updates (Admin only)

    Features:

    • Check for available Python CVE fixes (pip-audit)
    • Check for system package updates (apt)
    • Run updates with dry run preview
    • Real-time progress tracking
    • Automatic rollback on failure (via Ansible role)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions