MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / get_references

Function get_references

vulnerabilities/importers/fireeye.py:93–108  ·  view source on GitHub ↗

Return a list of Reference from a list of URL reference in md format >>> get_references(["- http://1-4a.com/cgi-bin/alienform/af.cgi"]) [Reference(reference_id='', reference_type='', url='http://1-4a.com/cgi-bin/alienform/af.cgi', severities=[])] >>> get_references(["- [Mitre CVE-20

(references)

Source from the content-addressed store, hash-verified

91
92
93def get_references(references):
94 """
95 Return a list of Reference from a list of URL reference in md format
96 >>> get_references(["- http://1-4a.com/cgi-bin/alienform/af.cgi"])
97 [Reference(reference_id='', reference_type='', url='http://1-4a.com/cgi-bin/alienform/af.cgi', severities=[])]
98 >>> get_references(["- [Mitre CVE-2021-42712](https://www.cve.org/CVERecord?id=CVE-2021-42712)"])
99 [Reference(reference_id='', reference_type='', url='https://www.cve.org/CVERecord?id=CVE-2021-42712', severities=[])]
100 """
101 urls = []
102 for ref in references:
103 if ref.startswith("- "):
104 urls.append(matcher_url(ref[2::]))
105 else:
106 urls.append(matcher_url(ref))
107
108 return [Reference(url=url) for url in urls if url]
109
110
111def matcher_url(ref) -> str:

Callers 2

test_get_refMethod · 0.90
parse_advisory_dataFunction · 0.70

Calls 2

ReferenceClass · 0.90
matcher_urlFunction · 0.70

Tested by 1

test_get_refMethod · 0.72