Skip to content
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

Merged
merged 7 commits into from
Nov 10, 2022
Merged

Fix appscreener parser #7077

merged 7 commits into from
Nov 10, 2022

Conversation

ncrl
Copy link
Contributor

@ncrl ncrl commented Nov 5, 2022

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.

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.
@github-actions github-actions bot added the parser label Nov 5, 2022
@damiencarol
Copy link
Contributor

@ncrl fixed some flake8 errors and improved some stuffs

Copy link
Contributor

@manuel-sommer manuel-sommer left a 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"

@ncrl ncrl changed the title Update parser.py Fix appscreener parser Nov 5, 2022
@ncrl ncrl changed the base branch from master to dev November 5, 2022 21:28
@ncrl
Copy link
Contributor Author

ncrl commented Nov 5, 2022

  • 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)
Copy link
Contributor Author

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

@manuel-sommer
Copy link
Contributor

@ncrl you have to request another approving review, e.g. from @damiencarol

Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@mtesauro mtesauro merged commit 050638d into DefectDojo:dev Nov 10, 2022
Maffooch pushed a commit that referenced this pull request Nov 14, 2022
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants