in foundation_security_advisories/common.py [0:0]
def to_json(self):
"""
Convert advisory in yml format into
[CVE JSON](https://cveproject.github.io/cve-schema/schema/docs/) format.
"""
return {
"containers": {
"cna": {
"affected": [
{
"product": instance.product,
"vendor": "Mozilla",
"versions": [
{
"lessThan": instance.version_fixed,
"status": "affected",
"version": "unspecified",
"versionType": "custom",
}
],
}
for instance in self.instances
],
"descriptions": [
{
"lang": "en",
"value": remove_html_tags(self.full_description),
"supportingMedia": [
{
"type": "text/html",
"base64": False,
"value": remove_newlines(self.full_description),
}
],
}
],
**(
{
"problemTypes": [
{
"descriptions": [
{
"description": remove_html_tags(
self.newest_instance.title
),
"lang": "en",
"type": "text",
}
]
}
]
}
if self.newest_instance.title
else {}
),
"references": [
{
"url": f"https://www.mozilla.org/security/advisories/mfsa{mfsa_id}/"
}
for mfsa_id in sorted(
set([instance.mfsa_id for instance in self.instances])
)
]
+ [
{
"url": url,
**({"name": desc} if desc else {}),
}
for url, desc in self.newest_instance.references
],
**(
{
"credits": [
{
"lang": "en",
"value": remove_html_tags(
self.newest_instance.reporter
),
}
],
}
if self.newest_instance.reporter
else {}
),
}
},
"dataType": "CVE_RECORD",
"dataVersion": "5.1",
}