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

Function get_weaknesses

vulnerabilities/importers/fireeye.py:150–166  ·  view source on GitHub ↗

Return the list of CWE IDs as integers from a list of weakness summaries, e.g., [379]. >>> get_weaknesses([ ... "CWE-379: Creation of Temporary File in Directory with Insecure Permissions", ... "CWE-362: Concurrent Execution using Shared Resource with Improper Synchroni

(cwe_data)

Source from the content-addressed store, hash-verified

148
149
150def get_weaknesses(cwe_data):
151 """
152 Return the list of CWE IDs as integers from a list of weakness summaries, e.g., [379].
153
154 >>> get_weaknesses([
155 ... "CWE-379: Creation of Temporary File in Directory with Insecure Permissions",
156 ... "CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')"
157 ... ])
158 [379, 362]
159 """
160 cwe_list = []
161 for line in cwe_data:
162 cwe_ids = re.findall(cwe_regex, line)
163 cwe_list.extend(cwe_ids)
164
165 weaknesses = create_weaknesses_list(cwe_list)
166 return weaknesses

Callers 2

test_get_weaknessesMethod · 0.90
parse_advisory_dataFunction · 0.70

Calls 1

create_weaknesses_listFunction · 0.90

Tested by 1

test_get_weaknessesMethod · 0.72