-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix appscreener parser #7077
Fix appscreener parser #7077
Conversation
Error, when trying to parse appscreener report. [05/Nov/2022 01:41:15] ERROR [dojo.engagement.views:683] invalid literal for int() with base 10: '' Traceback (most recent call last): File "/app/./dojo/engagement/views.py", line 668, in import_scan_results test, finding_count, closed_finding_count, _ = importer.import_scan(scan, scan_type, engagement, user, environment, active=active, verified=verified, tags=tags, File "/app/./dojo/importers/importer/importer.py", line 298, in import_scan parsed_findings = parser.get_findings(scan, test) File "/app/./dojo/tools/solar_appscreener/parser.py", line 50, in get_findings finding.line = int(finding.line) ValueError: invalid literal for int() with base 10: '' Because first line transfer to string after split. This fix should resolve it. I checked - all ok.
@ncrl fixed some flake8 errors and improved some stuffs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please update the PR name "Update parser.py" to a more descriptive name, e.g. "Fix appscreener parser"
- Please update the target branch from "DefectDojo:master" to "DefectDojo:dev"
Done! |
@@ -47,7 +47,7 @@ def get_findings(self, filename, test): | |||
if finding.line: | |||
if not finding.line.isdigit(): | |||
finding.line = finding.line.split("-")[0] | |||
finding.line = int(finding.line) | |||
finding.line = int(finding.line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the error is still there, because after split if '-' will be on input string got on output. @damiencarol
@ncrl you have to request another approving review, e.g. from @damiencarol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
* Update parser.py Error, when trying to parse appscreener report. [05/Nov/2022 01:41:15] ERROR [dojo.engagement.views:683] invalid literal for int() with base 10: '' Traceback (most recent call last): File "/app/./dojo/engagement/views.py", line 668, in import_scan_results test, finding_count, closed_finding_count, _ = importer.import_scan(scan, scan_type, engagement, user, environment, active=active, verified=verified, tags=tags, File "/app/./dojo/importers/importer/importer.py", line 298, in import_scan parsed_findings = parser.get_findings(scan, test) File "/app/./dojo/tools/solar_appscreener/parser.py", line 50, in get_findings finding.line = int(finding.line) ValueError: invalid literal for int() with base 10: '' Because first line transfer to string after split. This fix should resolve it. I checked - all ok. * Update parser.py * Update parser.py * Update parser.py * Update parser.py * Fix error: ValueError: invalid literal for int() with base 10: '' * Update parser.py Flake8 fix Co-authored-by: Damien Carol <damien.carol@gmail.com>
Error, when trying to parse appscreener report.
[05/Nov/2022 01:41:15] ERROR [dojo.engagement.views:683] invalid literal for int() with base 10: '' Traceback (most recent call last):
File "/app/./dojo/engagement/views.py", line 668, in import_scan_results
test, finding_count, closed_finding_count, _ = importer.import_scan(scan, scan_type, engagement, user, environment, active=active, verified=verified, tags=tags,
File "/app/./dojo/importers/importer/importer.py", line 298, in import_scan
parsed_findings = parser.get_findings(scan, test)
File "/app/./dojo/tools/solar_appscreener/parser.py", line 50, in get_findings
finding.line = int(finding.line)
ValueError: invalid literal for int() with base 10: ''
Because first line transfer to string after split. This fix should resolve it. I checked - all ok.