Each scanner (e.g., Trivy, Snyk, Grype) produces reports in different JSON structures. A CEL expression written for one scanner might not work for another due to differences in field names.
Example
Trivy JSON Structure
{
"ArtifactName": "nginx:latest",
"Results": [
{
"Target": "nginx:latest",
"Vulnerabilities": [
{
"VulnerabilityID": "CVE-2023-1234",
"Severity": "CRITICAL"
}
]
}
]
}
CEL Expression (Valid for Trivy)
report.Results.exists(r, r.Vulnerabilities.exists(v, v.Severity == 'CRITICAL'))
Snyk JSON Structure
{
"vulnerabilities": [
{
"id": "CVE-2023-1234",
"severity": "critical"
}
]
}
CEL Expression (Valid for Snyk)
report.vulnerabilities.exists(v, v.severity == 'critical')
If it tries to evaluate the Trivy CEL expression against a Snyk report, it will fail because Results and Vulnerabilities don’t exist in Snyk's JSON. So, before evaluating a CEL expression, check if it matches the structure expected for that scanner. And have it plugable/extendable support.
Each scanner (e.g., Trivy, Snyk, Grype) produces reports in different JSON structures. A CEL expression written for one scanner might not work for another due to differences in field names.
Example
Trivy JSON Structure
CEL Expression (Valid for Trivy)
Snyk JSON Structure
CEL Expression (Valid for Snyk)
If it tries to evaluate the Trivy CEL expression against a Snyk report, it will fail because
ResultsandVulnerabilitiesdon’t exist in Snyk's JSON. So, before evaluating a CEL expression, check if it matches the structure expected for that scanner. And have it plugable/extendable support.