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

error on import bearer cli report #11245

Closed
saldam72 opened this issue Nov 12, 2024 · 3 comments
Closed

error on import bearer cli report #11245

saldam72 opened this issue Nov 12, 2024 · 3 comments
Labels

Comments

@saldam72
Copy link

Hello,
I have tried to import json report that I have got scanning webgoat with bearer version 1.46.4, build 380afa10188c8a5e5a4f3c6ebe7009373b44137f but I got the error "An exception error occurred during the report import: 'snippet'" (see details below)

uwsgi-1 | [12/Nov/2024 14:26:46] ERROR [dojo.engagement.views:933] 'snippet'
uwsgi-1 | Traceback (most recent call last):
uwsgi-1 | File "/app/dojo/engagement/views.py", line 924, in import_findings
uwsgi-1 | context["test"], _, finding_count, closed_finding_count, _, _, _ = importer_client.process_scan(
uwsgi-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1 | File "/app/dojo/importers/default_importer.py", line 107, in process_scan
uwsgi-1 | self.parsed_findings = self.parse_findings(scan, parser)
uwsgi-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1 | File "/app/dojo/importers/default_importer.py", line 313, in parse_findings
uwsgi-1 | self.parsed_findings = self.parse_findings_static_test_type(scan, parser)
uwsgi-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1 | File "/app/dojo/importers/default_importer.py", line 330, in parse_findings_static_test_type
uwsgi-1 | return super().parse_findings_static_test_type(scan, parser)
uwsgi-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1 | File "/app/dojo/importers/base_importer.py", line 161, in parse_findings_static_test_type
uwsgi-1 | return parser.get_findings(scan, self.test)
uwsgi-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uwsgi-1 | File "/app/dojo/tools/bearer_cli/parser.py", line 36, in get_findings
uwsgi-1 | description=bearerfinding["description"] + "\n Detected code snippet: \n" + bearerfinding["snippet"],
uwsgi-1 | ~~~~~~~~~~~~~^^^^^^^^^^^
uwsgi-1 | KeyError: 'snippet'

Then I have renamed "code_extract" property with "snippet and I have successufully imported the report.

Regards,
Sal

@saldam72 saldam72 added the bug label Nov 12, 2024
manuel-sommer added a commit to manuel-sommer/django-DefectDojo that referenced this issue Nov 12, 2024
@manuel-sommer
Copy link
Contributor

Could you test this PR @saldam72 ?

@saldam72
Copy link
Author

Hi Manuel,
I cannot test this PR because at the moment I cannot build image.

Regards,
Sal

mtesauro pushed a commit that referenced this issue Nov 15, 2024
* 🐛 fix bearer_cli #11245

* ruff
@manuel-sommer
Copy link
Contributor

@saldam72 , could you please close this issue? The PR is merged already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants