Could someone please help to generate Vulnerability report via rest api for artifacts? Maybe sample example will help. Looked at the below documentation but not clear to me https://www.jfrog.com/confluence/display/JFROG/Xray+REST+API#XrayRESTAPI-GenerateVulnerabilitiesReport
Asked
Active
Viewed 315 times
0
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jan 20 '22 at 21:22
1 Answers
0
I assume your Xray version is 3.x, kindly follow the below curl command which should give you the report,
curl -u<username>:<password> http://artifactory_URL/xray/api/v1/reports/vulnerabilities -H 'Content-Type: application/json' -d @report.json
In the report.json file, add the information which you need to generate the report for. For example:
cat report.json {
"name": "report1",
"resources": {
"repositories": [
{
"name": "libs-release-local"
}
],
"builds": {
"names": [
"art-docker-test",
"art-docker-prod"
]
}
},
"filters": {
"vulnerable_component": "*vulnerable:component*",
"impacted_artifact": "some://impacted*artifact",
"has_remediation": false,
"cve": "CVE-1234-1234",
"issue_id": "XRAY-1234",
"severities": [
"High",
"Medium"
],
"cvss_score": {
"min_score": 6.3,
"max_score": 9
},
"published": {
"start": "2020-06-29T12:22:16Z",
"end": "2020-06-29T12:22:16Z"
},
"scan_date": {
"start": "2020-06-29T12:22:16Z",
"end": "2020-06-29T12:22:16Z"}
}
}
I'm generating a report for the repository "libs-release-local" and build name "art-docker-test" and "art-docker-prod" with filters as you can understand.
Muhammed Kashif
- 1,088
- 2
- 5
-
Thanks Muhammed. Could you plz let me know how to find the issue ID.Is there any way to pass some of the above info using variables coz i want to generate report for multiple repos ..dont want to hardcode – dell xps Jan 10 '22 at 16:38
-
If you are using shell script or postman then you can use variables, you can also refer to this stackoverflow for variables in curl https://stackoverflow.com/questions/13341955/how-to-pass-a-variable-in-a-curl-command-in-shell-scripting – Muhammed Kashif Jan 11 '22 at 04:14