Automatically fix CVE vulnerabilities in Python dependencies for downstream projects. Queries Jira for unresolved CVEs, filters already-fixed issues, updates Pipfile and Pipfile.lock using container-based pipenv lock, creates MRs, and updates Jira. Use when the user mentions CVEs, vulnerabilities, security fixes, CVE remediation, dependency security updates, or asks to fix CVEs.
Automated CVE remediation for Python dependencies. Queries Jira for CVEs, updates Pipfile and Pipfile.lock, creates MRs, and updates Jira.
These are hard-won from production use. Follow them strictly:
origin/main, never from another feature branch. Cross-contamination has caused multiple MR issues.isinstance() checks before .get() on variables that might be error strings instead of dicts (e.g., when pipenv lock fails).pytest --collect-only to catch import errors from missing transitive dependencies before CI.Load the developer persona first:
persona_load("developer")
Tools used: jira_search, jira_view_issue, jira_assign, jira_transition, jira_add_comment, git_fetch, git_branch_list, git_branch_create, git_checkout, git_add, git_commit, git_push, gitlab_mr_list, gitlab_mr_create, podman_build, podman_run, memory_session_log, jira_attach_session
Query Jira for CVEs:
jira_search(jql='"Downstream Component Name" ~ "<component>" AND type = Vulnerability AND resolution = Unresolved ORDER BY created DESC', max_results=50)
Default component: automation-analytics-backend
Fetch latest from origin with prune to get up-to-date refs.
Check git log on origin/main (last 500 commits) to find already-merged fixes.
Check all branches for in-progress CVE work.
Check open MRs for existing CVE fix MRs.
Classify each CVE into one of:
Select CVEs to process: Prioritize resumable CVEs over new ones. Default: process 1 at a time.
Get CVE details from Jira using jira_view_issue.
Extract CVE info - see cve-parsing.md for detailed extraction strategies. Need:
CVE-2024-12345)Validate the CVE:
Check compatibility requirements - consult compatibility.md for known breaking changes when upgrading the affected package.
If resuming a CVE that already has a branch:
origin/<branch>).origin/main to detect what's already done.[email protected]).* CVE-XXXX vulnerability in <package> is remediated
* <package> is updated to a version that fixes CVE-XXXX
* Pipfile and Pipfile.lock are updated with the new version
* No regressions in existing functionality
* CI pipeline passes
Skip this phase if resuming (already on feature branch).
origin/main (critical for branch isolation).<ISSUE_KEY>-<cve-id>-<package> (e.g., AAP-12345-cve-2025-69223-aiohttp).origin/main exactly (merge-base check).Skip if already committed (resume case).
This uses a container-based approach to resolve package versions with the correct Python version:
Read Python version from the project's Pipfile [requires] section.
Map to UBI container image:
| Python | Image |
|---|---|
| 3.9 | registry.access.redhat.com/ubi9/python-39 |
| 3.11 | registry.access.redhat.com/ubi9/python-311 |
| 3.12 | registry.access.redhat.com/ubi9/python-312 |
Create temp workspace in /tmp/cve-fix-* with:
Build container with podman_build (installs pip + pipenv).
Run pipenv lock inside the container with the temp dir volume-mounted.
Extract new version and hashes from the generated Pipfile.lock.
Update project Pipfile:
>= <new_version> with CVE comment[packages] headerUpdate project Pipfile.lock:
Clean up temp directory.
<ISSUE_KEY> - fix(deps): update <package> <old> -> <new> to fix <CVE-ID>--set-upstream.Build MR title: <ISSUE_KEY> - fix(security): fix <CVE-ID> in <package>
Build MR description with sections:
Create MR via gitlab_mr_create (not draft).
notify_team skill with cve_fix template.scan_vulnerabilities skill (if commit SHA available).When dry_run is true, show what would be done without making any changes. Display the CVE status summary table and planned steps.
Present results as a markdown table:
| Status | Count | Issues |
|---|---|---|
| Merged to main | N | AAP-... |
| Has Open MR | N | AAP-... |
| Resumable | N | AAP-... |
| Needs Work | N | AAP-... |
For each processed CVE, show: