1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
[% USE date -%]
[% PERL -%]
use JSON;
[% END -%]
[% MACRO jsonvar(var) PERL -%]
# JSON-encode the given variable, including quotes
print JSON::encode_json($stash->get($stash->get('var')));
[% END %]
[%- SET adv = advdb.advisories.$advisory -%]
{
"schema_version": "1.6.2",
"id": [% jsonvar('advisory') %],
"published": "[% date.format(adv.status.published, format => '%Y-%m-%dT%H:%M:%SZ', gmt => 1) %]",
"modified": "[% date.format(adv.status.modified, format => '%Y-%m-%dT%H:%M:%SZ', gmt => 1) %]",
"summary": [% jsonvar('adv.subject') %],
"details": [% jsonvar('adv.description') %],
[% IF adv.CVE && adv.CVE.list.size != 0 -%]
"related": [
[% FOREACH cve IN adv.CVE -%]
[% jsonvar('cve') -%]
[% "," IF ! loop.last %]
[% END -%]
],
[% END -%]
"references": [
{
"type": "ADVISORY",
"url": "[% config.site_url %]/[% basename.ID(advisory) %].html"
}
[%- "," IF adv.references && adv.references.list.size != 0 %]
[% FOREACH ref IN adv.references -%]
{
"type": "REPORT",
"url": [% jsonvar('ref') %]
}
[%- "," IF ! loop.last %]
[% END -%]
],
"affected": [
[% USE srciter = iterator(adv.src.keys) -%]
[% FOREACH rel IN srciter -%]
[% USE mediaiter = iterator(adv.src.$rel.keys) -%]
[% FOREACH media IN mediaiter -%]
[% FOREACH srpm IN adv.src.$rel.$media -%]
{
"package": {
"ecosystem": "Mageia:[% rel %]",
[% USE pkg = String(srpm) -%]
[% FOREACH part IN pkg.split('-[\w\.+~^]+-[\w\.]+\.mga\d+') -%]
[% SET pkgname = part -%]
[% LAST -%]
[% END -%]
"name": [% jsonvar('pkgname') %],
[% CALL pkg.shift(pkgname) -%]
[% CALL pkg.shift('-') -%]
[% SET pkgver = pkg.text -%]
[% USE purl = String('pkg:rpm/mageia/') -%]
[% CALL purl.push(pkgname) -%]
[% CALL purl.push('?distro=mageia-') -%]
[% CALL purl.push(rel) -%]
[% SET purltext = purl.text -%]
"purl": [% jsonvar('purltext') %]
},
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "0"
},
{
"fixed": [% jsonvar('pkgver') %]
}
]
}
],
"ecosystem_specific": {
"section": [% jsonvar('media') %]
}
}
[%- "," IF ! loop.last || ! mediaiter.last || ! srciter.last %]
[% END %]
[%- END -%]
[%- END -%]
],
"credits": [
{
"name": "Mageia",
"type": "COORDINATOR",
"contact": [
"https://wiki.mageia.org/en/Packages_Security_Team"
]
}
]
}
|