Skip to content

Commit 969771d

Browse files
committed
Updated Recommendation Url to pass through when see_also is empty #43
1 parent d73de1c commit 969771d

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

tenable_aws_sechub/finding.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"""
55

66
from typing import Dict
7-
from restfly.utils import dict_flatten, dict_clean, trunc
8-
import arrow
97

8+
import arrow
9+
from restfly.utils import dict_clean, dict_flatten, trunc
1010

1111
SEV_MAP = {0: 0, 1: 3, 2: 5, 3: 7, 4: 10}
1212
STATE_MAP = {
@@ -153,7 +153,9 @@ def generate(self, vuln: Dict) -> Dict:
153153
'Recommendation': {
154154
# The solution cannot exceed 1024 characters in length.
155155
'Text': trunc(vuln['plugin.solution'], 512),
156-
'Url': vuln.get('plugin.see_also', [])[0],
156+
'Url': vuln.get('plugin.see_also')[0]
157+
if vuln.get('plugin.see_also')
158+
else None,
157159
}
158160
},
159161
'RecordState': STATE_MAP[vuln['state']],

tenable_aws_sechub/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '2.0.4'
1+
version = '2.0.5'

tests/test_finding.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from tenable_aws_sechub.finding import Finding
34

45

@@ -97,3 +98,12 @@ def test_finding_generate_finding_success(finding_aws):
9798
finding_aws['state'] = 'FIXED'
9899
resp = f.generate(finding_aws)
99100
assert resp['RecordState'] == 'ARCHIVED'
101+
102+
103+
def test_generate_finding_none_url(finding_aws):
104+
f = Finding('AWS-REGION-1', 'ACCOUNT-ID')
105+
106+
del finding_aws['plugin.see_also']
107+
resp = f.generate(finding_aws)
108+
109+
assert 'Url' not in resp['Remediation']['Recommendation']

0 commit comments

Comments
 (0)