diff options
author | Dan Fandrich <danf@mageia.org> | 2024-03-08 18:33:47 -0800 |
---|---|---|
committer | Dan Fandrich <danf@mageia.org> | 2024-03-08 23:55:05 -0800 |
commit | de98902a85982351c7539672391de014252edde5 (patch) | |
tree | e6659a58712ffb9c7f99410d3f282ad23ff8dbbf /mgaadv | |
parent | 3b4f039b1fc76a1f7cd87b55f74d76da1e9e8e09 (diff) | |
download | mgaadvisories-de98902a85982351c7539672391de014252edde5.tar mgaadvisories-de98902a85982351c7539672391de014252edde5.tar.gz mgaadvisories-de98902a85982351c7539672391de014252edde5.tar.bz2 mgaadvisories-de98902a85982351c7539672391de014252edde5.tar.xz mgaadvisories-de98902a85982351c7539672391de014252edde5.zip |
Add 'showjson' command to output an advisory in OSV JSON
Open Source Vulnerability format is a standard for publishing
vulnerabilities in Open Source projects and is defined at
https://ossf.github.io/osv-schema/
Diffstat (limited to 'mgaadv')
-rwxr-xr-x | mgaadv | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -111,6 +111,15 @@ $0 show [ID] Show an advisory. END }, + showjson => { + run => \&showadvjson, + descr => 'Show an advisory in JSON format', + usage => <<END, +$0 showjson [ID] + +Show an advisory in JSON format. +END + }, update => { run => \&updateadv, descr => 'Update the advisories database', @@ -219,6 +228,14 @@ sub showadv { MGA::Advisories::showadv(\%advdb, $adv); } +sub showadvjson { + usageexit('usage', $_[0]) unless @_ == 2; + my $adv = $_[1]; + my %advdb; + $advdb{advisories} = MGA::Advisories::get_advisories(); + MGA::Advisories::showadvjson(\%advdb, $adv); +} + sub updateadv { usageexit('usage', $_[0]) unless @_ == 1; MGA::Advisories::download_advisories; |