一键导入
maven-vuln-fix
Query and fix Maven dependency vulnerabilities reported by GitHub Dependabot using OSV API
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Query and fix Maven dependency vulnerabilities reported by GitHub Dependabot using OSV API
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | maven-vuln-fix |
| description | Query and fix Maven dependency vulnerabilities reported by GitHub Dependabot using OSV API |
| source | auto-skill |
| extracted_at | 2026-06-22T02:45:26.806Z |
When GitHub reports Dependabot vulnerabilities on a Maven project, the security page often requires authentication to view details. Use the OSV (Open Source Vulnerabilities) API to identify and fix them.
mvn dependency:tree 2>&1 | grep -v '^\[INFO\] ---' | grep -v 'BUILD'
For each dependency in pom.xml, query the OSV API:
curl -s -X POST https://api.osv.dev/v1/query \
-H "Content-Type: application/json" \
-d '{"package":{"name":"<groupId>:<artifactId>","ecosystem":"Maven"},"version":"<version>"}' \
| python3 -m json.tool
{} response means no known vulnerabilities."vulns" array contains CVE details, affected versions, and the "fixed" version.for pkg in "groupId:artifactId:version" ...; do
name=$(echo $pkg | cut -d: -f1,2)
ver=$(echo $pkg | cut -d: -f3)
result=$(curl -s -X POST https://api.osv.dev/v1/query \
-H "Content-Type: application/json" \
-d "{\"package\":{\"name\":\"$name\",\"ecosystem\":\"Maven\"},\"version\":\"$ver\"}")
if [ "$result" != "{}" ]; then
echo "=== VULNERABLE: $name:$ver ==="
echo "$result" | python3 -m json.tool | head -40
fi
done
Edit pom.xml to bump each vulnerable dependency to its "fixed" version from the OSV response.
mvn clean compile
mvn test
If ~/.m2/settings.xml uses http://maven.aliyun.com/nexus/content/groups/public (HTTP, not HTTPS), new artifacts may return 403 Forbidden. Fix by changing the mirror URL to HTTPS:
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
Or temporarily use a custom settings file:
mvn clean compile -s /path/to/https-settings.xml
| Field | Meaning |
|---|---|
aliases | CVE identifiers (e.g., CVE-2025-7962) |
summary | Short description |
database_specific.severity | MODERATE, HIGH, CRITICAL |
affected[].ranges[].events | introduced and fixed version pairs |