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

A string literal cannot contain NUL (0x00) characters - Anchore Grype #9942

Closed
1 of 3 tasks
corvusmod opened this issue Apr 17, 2024 · 4 comments
Closed
1 of 3 tasks
Labels

Comments

@corvusmod
Copy link

Bug description
While import Anchore Grype scan result I got some error
A string literal cannot contain NUL (0x00) characters., Maybe it's about the value in json report file.

Similar to: #9939

Steps to reproduce
Imported an error with dd-importer

Expected behavior
No error importing Anchore Grype reports

Deployment method (select with an X)

  • Docker Compose
  • Kubernetes
  • GoDojo

Environment information

  • DefectDojo version 2.27.4

Logs

[pid: 1|app: -|req: -/-] 10.20.21.225 (-) {50 vars in 835 bytes} [Wed Apr 17 12:35:14 2024] GET //api/v2/tests/?title=Anchore+Grype&engagement=2209 => generated 607 bytes in 39 msecs (HTTP/1.1 200) 8 headers in 246 bytes (1 switches on core 0) [17/Apr/2024 12:35:14] ERROR [dojo.api_v2.exception_handler:36] A string literal cannot contain NUL (0x00) characters. Traceback (most recent call last): File "/app/dojo/api_v2/serializers.py", line 2502, in save ) = reimporter.reimport_scan( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/dojo/importers/reimporter/reimporter.py", line 682, in reimport_scan ) = self.process_parsed_findings( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/dojo/decorators.py", line 48, in __wrapper__ return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/celery/local.py", line 182, in __call__ return self._get_current_object()(*a, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/celery/app/task.py", line 411, in __call__ return self.run(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/dojo/importers/reimporter/reimporter.py", line 332, in process_parsed_findings item.save(dedupe_option=False) File "/app/dojo/models.py", line 2915, in save self = apply_cwe_to_template(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/dojo/utils.py", line 1698, in apply_cwe_to_template cwe=finding.cwe, title__icontains=finding.title, template_match=True).first() ^^^^^^^ File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1047, in first for obj in (self if self.ordered else self.order_by("pk"))[:1]: File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 394, in __iter__ self._fetch_all() File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1867, in _fetch_all self._result_cache = list(self._iterable_class(self))

@corvusmod corvusmod added the bug label Apr 17, 2024
@manuel-sommer
Copy link
Contributor

Do you have a sample file @corvusmod ? Then, I can submit a bugfix.

@corvusmod
Copy link
Author

container-report-linux-amd64 2.json

I redacted some internal info... I don't know if it will still work, but you can check it.

@manuel-sommer
Copy link
Contributor

See PR @corvusmod

blakeaowens pushed a commit that referenced this issue Apr 22, 2024
* fix anchore_grype null characters issue, #9942

* fix null characters
@manuel-sommer
Copy link
Contributor

This is resolved and can be closed.

hblankenship pushed a commit to hblankenship/django-DefectDojo that referenced this issue Apr 26, 2024
…9962)

* fix anchore_grype null characters issue, DefectDojo#9942

* fix null characters
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