aboutsummaryrefslogtreecommitdiffstats
path: root/mgaadv
diff options
context:
space:
mode:
authorDan Fandrich <danf@mageia.org>2024-03-08 18:33:47 -0800
committerDan Fandrich <danf@mageia.org>2024-03-08 23:55:05 -0800
commitde98902a85982351c7539672391de014252edde5 (patch)
treee6659a58712ffb9c7f99410d3f282ad23ff8dbbf /mgaadv
parent3b4f039b1fc76a1f7cd87b55f74d76da1e9e8e09 (diff)
downloadmgaadvisories-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-xmgaadv17
1 files changed, 17 insertions, 0 deletions
diff --git a/mgaadv b/mgaadv
index ca519b0..78b1cf3 100755
--- a/mgaadv
+++ b/mgaadv
@@ -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;