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

modules.reportwriter.richtext.plain_text.py data-gw-evidence not replaced in output #462

Closed
domwhewell-sage opened this issue Jun 17, 2024 · 0 comments · Fixed by #463 or #466
Closed
Assignees
Labels
bug Something isn't working

Comments

@domwhewell-sage
Copy link

domwhewell-sage commented Jun 17, 2024

Describe the bug
When generating a XLSX document any evidence {{.X}} should be being replaced with
<See Report for Evidence File: X> Caption \u2013 X

However the get() to obtain the evidence ID from the evidences dictionary currently returns a NoneType

def _build_html_str(node, evidences, out: StringIO):
    if node.name is None:
        text = strip_text_whitespace(node)
        out.write(text)
        return

    if node.name == "span" and "data-gw-evidence" in node.attrs:
        evidence = evidences.get(node.attrs["data-gw-evidence"])
        if evidence is not None:
            out.write(
                f"\n<See Report for Evidence File: {evidence['friendly_name']}>\nCaption \u2013 {evidence['caption']}"
            )
            return

The node.attrs["data-gw-evidence"] will be a string (At least it has been in my testing) and it needs to be converted to <class 'int'> to match the dictionary key

To Reproduce
Steps to reproduce the behavior:

  1. Create a report with a finding that references an evidence file
  2. Generate that report as an XLSX document
  3. You will see instead of referencing the report "See Report for Evidence File..." the evidence reference has been replaced with whitespace

Expected Behavior
The evidence variable gets populated and the XLSX report contains "<See Report for Evidence File:...."

Server Specs:

  • Ghostwriter v4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants