BREAKING CHANGE: migration to new JSON schema #1050
Replies: 3 comments 1 reply
-
I saw the warning today as we upgraded to 0.19.1 and I want to just say thanks. This new schema is a massive improvement. |
Beta Was this translation helpful? Give feedback.
-
@knqyf263 @tofuatjava Trivy support was recently added to Jenkins in the warnings-ng and analysis-model plugins. This will need to be updated for the new schema? jenkinsci/warnings-ng-plugin#711 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the heads-up, that was an easy fix. Really nice, that this was testable with the Environment variable beforehand. |
Beta Was this translation helpful? Give feedback.
-
Overview
We will migrate the JSON schema of scan results to a new schema in
v0.20.0
. You might need to update your JSON parser.v0.19.0
displays a warning as below when you specify-f json
.Impact
Trivy CLI
This change affects
--format/-f json
option regardless of scanning modes such asimage
,fs
, andclient
.v0.20.0
will generate JSON with a different schema.if you parse the JSON output from Trivy, this change breaks your script.
-f table
(default) and-f template
will not be affected by this change.GitHub Action (trivy-action)
Not affected
https://github.com/aquasecurity/trivy-action
Schema Change
Current:
New:
The current data structure will be kept intact and moved under
Results
.NOTE: This new schema is subject to change before the release of v0.19.0.
Test
This new JSON schema is available in
v0.19.0
by specifyingTRIVY_NEW_JSON_SCHEMA=true
. The warning is not displayed.We apologize for the inconvenience, but please try this environment variable to fix your JSON parser.
TRIVY_NEW_JSON_SCHEMA
env will be removed inv0.20.0
, so you will not have to specify it inv0.20.0
or later.Examples
Here are some examples of what modifications might be needed.
jq
An example of jq parsing the result JSON and displaying the vulnerability IDs
Before:
After:
Python
An example of python parsing the result JSON and displaying the vulnerability IDs
Before:
After:
Diff
Beta Was this translation helpful? Give feedback.
All reactions