You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Failed to attach findings to engagement" error when sending trivy k8s scan results to DefectDojo #2271
We scan Kubernetes cluster using trivy k8s command with the flag --scanners=misconfig,rbac and the hook secureCodeBox/persistence-defectdojo fails with the following error:
Exception in thread "main" io.securecodebox.persistence.defectdojo.exception.PersistenceException: Failed to attach findings to engagement.
at io.securecodebox.persistence.defectdojo.service.DefaultImportScanService.createFindings(DefaultImportScanService.java:124)
at io.securecodebox.persistence.defectdojo.service.DefaultImportScanService.reimportScan(DefaultImportScanService.java:75)
at io.securecodebox.persistence.strategies.VersionedEngagementsStrategy.run(VersionedEngagementsStrategy.java:105)
at io.securecodebox.persistence.DefectDojoPersistenceProvider.main(DefectDojoPersistenceProvider.java:43)
changed the title [-]"Failed to attach findings to engagement" error when sending trivy scan results to DefectDojo[/-][+]"Failed to attach findings to engagement" error when sending trivy k8s scan results to DefectDojo[/+]on Feb 13, 2024
@danil-smirnov We are not sure where this error came from. In general the file upload of the findings works in the underlying code, but uploading Trivy results to DefectDojo is very rarely used. We try to reproduce this bug.
Until then, I've improved the error logging. Frankly, the error you got is not very helpful :-| We plan release of 4.4.0 at the end of week. You can try that version and give as the full stack trace.
2024-02-17 09:21:18 INFO DefectDojoPersistenceProvider:36 - Starting DefectDojo persistence provider
2024-02-17 09:21:26 INFO DefectDojoPersistenceProvider:42 - Downloading Scan Result
2024-02-17 09:21:36 INFO DefectDojoPersistenceProvider:47 - Uploading Findings to DefectDojo at: https://defectdojo.infra.mana.wtf
2024-02-17 09:21:38 INFO VersionedEngagementsStrategy:95 - Running with DefectDojo User Id: 1
2024-02-17 09:21:38 INFO VersionedEngagementsStrategy:248 - Looking for ID of ProductType 'Application'
2024-02-17 09:21:38 INFO VersionedEngagementsStrategy:255 - Using ProductType Id: 3
2024-02-17 09:21:40 ERROR DefaultImportScanService:128 - Exception while attaching findings to engagement: 413 Request Entity Too Large: "<html><EOL><EOL><head><title>413 Request Entity Too Large</title></head><EOL><EOL><body><EOL><EOL><center><h1>413 Request Entity Too Large</h1></center><EOL><EOL><hr><center>nginx</center><EOL><EOL></body><EOL><EOL></html><EOL><EOL>"
2024-02-17 09:21:40 ERROR DefectDojoPersistenceProvider:30 - Failed to attach findings to engagement.
io.securecodebox.persistence.defectdojo.exception.PersistenceException: Failed to attach findings to engagement.
at io.securecodebox.persistence.defectdojo.service.DefaultImportScanService.createFindings(DefaultImportScanService.java:129)
at io.securecodebox.persistence.defectdojo.service.DefaultImportScanService.reimportScan(DefaultImportScanService.java:80)
at io.securecodebox.persistence.strategies.VersionedEngagementsStrategy.run(VersionedEngagementsStrategy.java:144)
at io.securecodebox.persistence.DefectDojoPersistenceProvider.execute(DefectDojoPersistenceProvider.java:50)
at io.securecodebox.persistence.DefectDojoPersistenceProvider.main(DefectDojoPersistenceProvider.java:28)
Caused by: org.springframework.web.client.HttpClientErrorException: 413 Request Entity Too Large: "<html><EOL><EOL><head><title>413 Request Entity Too Large</title></head><EOL><EOL><body><EOL><EOL><center><h1>413 Request Entity Too Large</h1></center><EOL><EOL><hr><center>nginx</center><EOL><EOL></body><EOL><EOL></html><EOL><EOL>"
at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:145)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:168)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:825)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:783)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:717)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:608)
at io.securecodebox.persistence.defectdojo.service.DefaultImportScanService.exchangeRequest(DefaultImportScanService.java:135)
at io.securecodebox.persistence.defectdojo.service.DefaultImportScanService.createFindings(DefaultImportScanService.java:126)
... 4 more
There were 618 findings for this scan and the result hasn't passed through the DefectDojo ingress. We fixed this via the following annotations on the DefectDojo side:
nginx.ingress.kubernetes.io/proxy-body-size: 100m
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
Activity
Weltraumschaf commentedon Feb 9, 2024
Hi @danil-smirnov,
thanks for submitting this issue. We'll investigate this.
[-]"Failed to attach findings to engagement" error when sending trivy scan results to DefectDojo[/-][+]"Failed to attach findings to engagement" error when sending trivy k8s scan results to DefectDojo[/+]secureCodeBox#2271 Give Properties Explicit Names to What they Map
Weltraumschaf commentedon Feb 13, 2024
The exception came from the defectdojo-client-java lib:
The used lib version in the hook in 4.3.0 is:
#2271 Give Properties Explicit Names to What they Map
secureCodeBox#2271 Use Latest Release DD Client Lib to Improve Error …
secureCodeBox#2271 Use Latest K8s Java client lib
secureCodeBox#2271 Remove Space in Version Strings
secureCodeBox#2271 Update Gradle Wrapper to Version 8.6
Weltraumschaf commentedon Feb 14, 2024
@danil-smirnov We are not sure where this error came from. In general the file upload of the findings works in the underlying code, but uploading Trivy results to DefectDojo is very rarely used. We try to reproduce this bug.
Until then, I've improved the error logging. Frankly, the error you got is not very helpful :-| We plan release of 4.4.0 at the end of week. You can try that version and give as the full stack trace.
#2271 Use Latest Release DD Client Lib to Improve Error Logging
#2271 Use Latest K8s Java client lib
#2271 Remove Space in Version Strings
#2271 Update Gradle Wrapper to Version 8.6
danil-smirnov commentedon Feb 17, 2024
@Weltraumschaf Now the error message is quite clear:
There were 618 findings for this scan and the result hasn't passed through the DefectDojo ingress. We fixed this via the following annotations on the DefectDojo side:
Closing the issue.