Return generic helpURI if there are no CWEs
It can happen (by human error) that a rule may be missing CWEs in the warning text. So, to guard against that, if there are no CWEs, FlawFinder will generate and return a generic URI.
This commit is contained in:
parent
179a6100de
commit
25c90615b9
|
@ -587,6 +587,8 @@ class Hit(object):
|
|||
# Help uri for each defined rule. e.g. "https://dwheeler.com/flawfinder#FF1002"
|
||||
# return first CWE link for now
|
||||
def helpuri(self):
|
||||
if self.cwes() == '':
|
||||
return 'https://dwheeler.com/flawfinder#{}'.format(self.ruleid)
|
||||
cwe = re.split(',|!', self.cwes())[0] + ")"
|
||||
return link_cwe_pattern.sub(
|
||||
r'https://cwe.mitre.org/data/definitions/\2.html',
|
||||
|
|
Loading…
Reference in New Issue