<< All versions

Skill v1.0.0

currentAutomated scan100/100
che-incubator/dev-workflow-ai/batch-cve-fix
──Details
PublishedNovember 19, 2026 at 05:10 AM
Content Hashsha256:40b0c2a301bc256c...
Git SHAc8bcebe63d79
──Files
Files (1 file, 6.5 KB)
SKILL.md6.5 KBactive
SKILL.md · 234 lines · 6.5 KB

name: batch-cve-fix description: Combine all open CVE/Security issues (≤15) for a project into one branch and one PR. Upgrades all vulnerable packages in a single bulk commit. Run before any normal issue loop iteration. argument-hint: "[project-name] (e.g., che-dashboard)" metadata: version: "1.0.0"


Batch CVE Fix

Purpose

Groups multiple open CVE/Security dependency-upgrade issues into one branch, one commit, one PR — matching the pattern at https://github.com/eclipse-che/che-dashboard/pull/1662.

Run this skill before the normal run-loop pick cycle whenever the project has 2 or more open CVE/Security issues.


Phase 1: Detect CVE Issues

1.1 Query open CVE/Security issues

bash
# Via agent API (returns issues sorted by score DESC):
curl -s "http://localhost:3000/api/sources/issues?status=open&limit=50" | \
python3 -c "
import sys, json
issues = json.load(sys.stdin)
cves = [i for i in issues if
'Security' in (i.get('labels') or []) or
'security' in (i.get('labels') or []) or
'CVE-' in i.get('title','')]
print(f'CVE issues found: {len(cves)}')
for i in cves:
print(f\" {i['external_id']} | {i['title'][:60]} | score={i['score']}\")
"

If 0 CVE issues → stop, run normal run-loop. If 1 CVE issue → run normal run-loop for that single issue. If 2–15 CVE issues → proceed with this batch skill. If ≥16 CVE issues → run this skill multiple times, 15 issues per batch.

1.2 Verify all issues are dependency upgrades

Each CVE issue title should match: "Upgrade <package>…", "CVE-YYYY-NNNNN … <package>", or contain a package name and version number.

If an issue requires source code changes (not just a version bump), exclude it from the batch and handle separately via run-loop.


Phase 2: Extract Package Upgrades

For each CVE issue, extract:

FieldWhere to find it
Package nameIssue title — word after "Upgrade" or before CVE ID
Target versionIssue title — "to version X.Y.Z" or "to X.Y.Z"
npm latestnpm info <package> version if no version in title
python
import re
def parse_upgrade(title):
# "Upgrade fastify to 5.2.1"
# "CVE-2026-84469 fastify: Header validation bypass — upgrade to 5.x"
pkg_match = re.search(r'upgrad\w+\s+([\w@/-]+)', title, re.I)
ver_match = re.search(r'\bto\s+(?:version\s+)?([\d]+\.[\d]+\.[\d]+)', title, re.I)
pkg = pkg_match.group(1).lower() if pkg_match else None
ver = ver_match.group(1) if ver_match else None
return pkg, ver

If version is missing → resolve from npm:

bash
npm info <package> version

Phase 3: Trigger Batch Run via API

bash
# This picks all CVE issues automatically and starts one run:
RESULT=$(curl -s -X POST http://localhost:3000/api/runs/cve-batch)
echo $RESULT | python3 -c "
import sys, json
d = json.load(sys.stdin)
print('Thread:', d['threadId'])
print('Issues:', d['count'])
for i in d.get('issues', []):
print(' -', i.get('title','')[:60])
"

Monitor the run:

bash
THREAD_ID=<from above>
curl -s "http://localhost:3000/api/runs/${THREAD_ID}" | \
python3 -c "import sys,json; d=json.load(sys.stdin); print(d['status'], d.get('messages',[''])[-1])"

Phase 4: Manual Implementation (if API is not available)

If running without the API, implement manually:

4.1 Create batch branch

bash
PROJECT=<project-name from context.md local_path>
cd $PROJECT
git checkout main && git pull
BRANCH="cve-batch-$(date +%Y%m%d)-deps"
git checkout -b $BRANCH

4.2 Bump all vulnerable packages

bash
# For each package extracted in Phase 2:
# (repeat for each CVE package)
PACKAGE=fastify
VERSION=5.2.1 # or: VERSION=$(npm info $PACKAGE version)
# Update package.json (finds all occurrences in monorepo):
find . -name "package.json" -not -path "*/node_modules/*" | \
xargs grep -l "\"${PACKAGE}\"" | \
xargs python3 -c "
import sys, json, re
for path in sys.argv[1:]:
with open(path) as f:
pkg = json.load(f)
changed = False
for section in ['dependencies', 'devDependencies', 'peerDependencies']:
if section in pkg and '${PACKAGE}' in pkg[section]:
pkg[section]['${PACKAGE}'] = '^${VERSION}'
changed = True
if changed:
with open(path, 'w') as f:
json.dump(pkg, f, indent=2)
f.write('\n')
print('Updated:', path)
" $(find . -name "package.json" -not -path "*/node_modules/*")

4.3 Install and verify

bash
yarn install --silent
yarn build
yarn test

4.4 Commit

bash
# Replace with actual CVE keys and packages:
git add package.json packages/*/package.json yarn.lock
git commit -m "fix(deps): batch CVE fixes — CRW-12921, CRW-12931, CRW-12925
Upgrades to address:
- CRW-12921 / CVE-2026-84469: fastify → 5.2.1
- CRW-12931 / CVE-2026-19534: undici → 7.3.0
- CRW-12925 / CVE-2026-84428: @fastify/cors → 11.0.1
Assisted-by: Claude Sonnet 4.6
Signed-off-by: ..."

4.5 Open PR

bash
REPO=eclipse-che/che-dashboard
gh pr create --repo $REPO \
--title "fix(deps): batch CVE fixes — CRW-12921, CRW-12931, CRW-12925 (3 packages)" \
--body "$(cat <<'EOF'
## Summary
Batch upgrade of vulnerable npm dependencies to address 3 CVE issues.
## CVEs Fixed
| Jira | CVE | Package | Old | New |
|---|---|---|---|---|
| [CRW-12921](https://redhat.atlassian.net/browse/CRW-12921) | CVE-2026-84469 | fastify | 4.x | 5.2.1 |
| [CRW-12931](https://redhat.atlassian.net/browse/CRW-12931) | CVE-2026-19534 | undici | 6.x | 7.3.0 |
| [CRW-12925](https://redhat.atlassian.net/browse/CRW-12925) | CVE-2026-84428 | @fastify/cors | 10.x | 11.0.1 |
## Test plan
- [ ] `yarn build` passes
- [ ] `yarn test` passes
- [ ] No breaking API changes (only patch/minor bumps)
Resolves CRW-12921, CRW-12931, CRW-12925
EOF
)"

Phase 5: Monitor CI and Review

Same as run-loop Phase 5–6:

bash
gh pr checks <PR_NUM> --repo $REPO --watch

If CI fails on a specific package bump:

  1. Check the failure: gh run view --log-failed
  2. If the bump introduced a breaking change, revert that package to the previous version and re-run
  3. Open a separate PR for the problematic package with source code fixes

Output Report

## Batch CVE Fix Complete
**Project:** che-dashboard
**Branch:** cve-batch-20260913-deps
**PR:** #1662 — https://github.com/eclipse-che/che-dashboard/pull/1662
**Packages upgraded:** fastify 4.x→5.2.1, undici 6.x→7.3.0, @fastify/cors 10.x→11.0.1
**CVEs addressed:** CRW-12921, CRW-12931, CRW-12925
**CI:** passing ✓
Issues resolved: 3 CVE issues closed in one PR.
All versions