Description
Hi Tenable team. I'm writing in with a single-line bug/typo in analysis.py > vulns() function that results in a 100% failure rate. The vulns() function contains if/else logic that appends 'wasVuln' to the filters list by "default." This is a typo/unexpected behavior causing 100% failure since 'wasVuln' is no longer a valid filter but the user-provided filter object is overwritten with this value.
In analysis.py > function vulns() > Lines 337-349 > Line 349
else:
# If the request is for a cumulative result, then we will an
# implicit filter to exclude WAS findings.
incl_filter = True
for f in filters:
if (
(isinstance(f, tuple) and f[0] == 'wasVuln')
or (isinstance(f, dict) and f['filterName'] == 'wasVuln')
):
incl_filter = False # <--- IGNORES USER-PROVIDED FILTER TUPLE
if incl_filter:
filters = list(filters)
filters.append(('wasVuln', '=', 'excludeWas')) # <--- THIS LOGIC ADDS THE "wasVuln" filter to the filters list!
Solution:
Comment out line 349 filters.append(('wasVuln', '=', 'excludeWas'))
else:
# If the request is for a cumulative result, then we will an
# implicit filter to exclude WAS findings.
incl_filter = True
for f in filters:
if (
(isinstance(f, tuple) and f[0] == 'wasVuln')
or (isinstance(f, dict) and f['filterName'] == 'wasVuln')
):
incl_filter = False
if incl_filter:
filters = list(filters)
# filters.append(('wasVuln', '=', 'excludeWas')) # <--- COMMENT OUT THIS LINE TO RESOLVE
To Reproduce
Assuming the following import statement:
from tenable.sc import TenableSC
Try: vulns = sc.analysis.vulns(filters=filters) (It does not matter what is provided in the filters object, all API calls will have 'wasVuln' appended to the request parameter, resulting in a 100% failure rate.)
Expected behavior
analysis.py > vulns() function should accept the user-provided filter object and should not append a non-existent filter to the request parameters. Instead, the user provided filter object should be included in the API request as-is.
Description Hi Tenable team. I'm writing in with a single-line bug/typo in
analysis.py
>vulns()
function that results in a 100% failure rate. Thevulns()
function contains if/else logic that appends 'wasVuln' to the filters list by "default." This is a typo/unexpected behavior causing 100% failure since 'wasVuln' is no longer a valid filter but the user-provided filter object is overwritten with this value.In
analysis.py
> functionvulns()
> Lines 337-349 > Line 349Solution:
Comment out line 349
filters.append(('wasVuln', '=', 'excludeWas'))
To Reproduce Assuming the following import statement:
from tenable.sc import TenableSC
vulns = sc.analysis.vulns(filters=filters)
(It does not matter what is provided in the filters object, all API calls will have 'wasVuln' appended to the request parameter, resulting in a 100% failure rate.)Expected behavior analysis.py >
vulns()
function should accept the user-provided filter object and should not append a non-existent filter to the request parameters. Instead, the user provided filter object should be included in the API request as-is.