Ghostwriter icon indicating copy to clipboard operation
Ghostwriter copied to clipboard

Generate DOCX report broken for existing findings with empty affected entities

Open smcgu opened this issue 9 months ago • 2 comments

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:

  1. Upgrade Ghostwriter from v4.1.0 to v4.2.0
  2. Open report
  3. Navigate to Generate tab
  4. Generate report -> Error

Steps to clear error:

  1. Navigate to Findings tab
  2. Open affected finding
  3. Submit (to save the finding)
  4. repeat for other findings
  5. Navigate to Generate tab
  6. Generate report

Expected Behavior

Findings with empty affected entities should not require them to be saved, again, after upgrade.

  1. Upgrade Ghostwriter from v4.1.0 to v4.2.0
  2. Open report
  3. Navigate to Generate tab
  4. 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.

smcgu avatar May 16 '24 02:05 smcgu