JFrog XRAY get violation with minimum jfrog_research_severity

127 views Asked by At

I have this API request:

{
        "filters": {
                "violation_type": "Security",
                "min_severity": "Critical",
                "created_from": "2023-08-22T12:22:16+03:00"
        },
        "pagination": {
                "order_by": "updated",
                "limit": 25,
                "offset": 1
        }
}

I get a response for example:

{
    "description": "SnakeYaml's Constructor() class does not restrict types which can be instantiated during deserialization. Deserializing yaml content provided by an attacker can lead to remote code execution. We recommend using SnakeYaml's SafeConsturctor when parsing untrusted content to restrict deserialization.",
    "severity": "Critical",
    "type": "Security",
    "infected_components": [
        "gav://org.yaml:snakeyaml:1.33"
    ],
    "created": "2023-08-22T09:22:28Z",
    "watch_name": "watch-docker",
    "issue_id": "XRAY-262821",
    "impacted_artifacts": [
        "default/docker-local/sse-engine/65267b09154da11879759fe41074b47eee66218f/"
    ],
    "component_physical_paths": [
        "sha256__20bea0ddcaa6071c9962a1862faa596943cba135793909ced4fe87faea823733.tar.gz/home/appcmeks/app.jar/BOOT-INF/lib/snakeyaml-1.33.jar"
    ],
    "extended_information": {
        "jfrog_research_severity": "Medium",
    },
    "applicability": null
}

Is there a way to change the API request so that the response will return only violations
with "jfrog_research_severity": "High" and above?

1

There are 1 answers

0
Dor Tambour On

This is not one of JFrog supported filter fields from the following documentation: https://jfrog.com/help/r/jfrog-rest-apis/get-violations

However, You can use the following jq command to filter this result:

curl -XPOST -u<user>:<password> <Artifactory_URL>/xray/api/v1/violations -H "Content-type: application/json" -T "<filters.json>" | jq '.violations | map(select(.extended_information.jfrog_research_severity == "High" or .extended_information.jfrog_research_severity == "Critical"))'