Ghostwriter
Ghostwriter copied to clipboard
Generate DOCX report broken for existing findings with empty affected entities
Describe the bug
Generating DOCX reports is broken for findings with empty affected entities. After upgrading from v4.1.0
to v4.2.0
, generating a DOCX report is broken when findings have empty affected entities. The error is "Error at the affected entities section of finding REDACTED: Invalid template operation: expected string or bytes-like object".
Opening the affected findings and saving them (with no changes) resolves the errors. So, there is something broken or changed from v4.1.0
to v4.2.0
.
To Reproduce
Steps to reproduce the error:
- Upgrade Ghostwriter from
v4.1.0
tov4.2.0
- Open report
- Navigate to Generate tab
- Generate report -> Error
Steps to clear error:
- Navigate to Findings tab
- Open affected finding
- Submit (to save the finding)
- repeat for other findings
- Navigate to Generate tab
- Generate report
Expected Behavior
Findings with empty affected entities should not require them to be saved, again, after upgrade.
- Upgrade Ghostwriter from
v4.1.0
tov4.2.0
- Open report
- Navigate to Generate tab
- Generate report -> no error
Screenshots
Available if needed.
Server Specs:
- OS: Ubuntu 22.04
- Docker: Docker version 26.1.1, build 4cf5afa
- Docker Compose: Docker Compose version v2.27.0
- Ghostwriter: v4.2.0, released 15 May 2024
Additional context
Reverting to v4.1.0
(and restoring backup postgres) resolves the issue.