Fix faradaysec executive report template macro

Jinja was looking for the following tags: 'endmacro'.

Upon FaradaySEC v3.12 we upgraded our jinja templates libraries, this affected our macro. In our original template the macro contains a "-" which is now incompatible and requires template update.
The correct macro is:
  1. {% macro severity(name) %}{% if name == "critical" %}Critical{% elif name == "high" %}High{% elif name == "med" %}Medium{% elif name == "low" %}Low{% elif name == "info" %}Informational{% elif name == "unclassified" %}Unclassified{% endif %}{% endmacro %}

Usually the error asociated with this issue is the following:

  1. jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'elif'. Jinja was looking for the following tags: 'endmacro'. The innermost block that needs to be closed is 'macro'.
Full traceback

  1. 2020-08-11T12:39:58-0300 - faraday.faraday.reports.executive_reports - ERROR {ReportsThread} [ - create_docx_report()]  Error creating report (another_workspace_symtai_webapp_dsadas): {Traceback (most recent call last):
  2.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/faraday/reports/", line 279, in create_docx_report
  3.     docx = docx_report.create_document(report,
  4.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/faraday/reports/executive/", line 443, in create_document
  5.     tpl.render(context, jinja_env)
  6.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/docxtpl/", line 283, in render
  7.     xml_src = self.build_xml(context, jinja_env)
  8.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/docxtpl/", line 242, in build_xml
  9.     xml = self.render_xml(xml, context, jinja_env)
  10.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/docxtpl/", line 230, in render_xml
  11.     raise exc
  12.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/docxtpl/", line 221, in render_xml
  13.     template = jinja_env.from_string(src_xml)
  14.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/Jinja2-3.0.0a1-py3.8.egg/jinja2/", line 896, in from_string
  15.     return cls.from_code(self, self.compile(source), globals, None)
  16.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/Jinja2-3.0.0a1-py3.8.egg/jinja2/", line 625, in compile
  17.     self.handle_exception(source=source_hint)
  18.   File "/Users/username/.pyenv/versions/faraday380/lib/python3.8/site-packages/Jinja2-3.0.0a1-py3.8.egg/jinja2/", line 787, in handle_exception
  19.     raise rewrite_traceback_stack(source=source)
  20.   File "<unknown>", line 1, in template
  21. jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'elif'. Jinja was looking for the following tags: 'endmacro'. The innermost block that needs to be closed is 'macro'.
  22. }
  23. 2020-08-11T12:39:58-0300 - faraday.faraday.reports.executive_reports - ERROR {ReportsThread} [ - create_docx_report()]  Please review your template

    Still looking for answers? You can try opening a ticket.
      • Related Articles

      • Faraday vulnerability search

        The vulnerability search allows you to build search queries to search for vulnerabilities. screenshot of vulnerability search Understanding search For using the search you need to know the vulnerability attributes and its relationships. Vulnerability ...
      • Executive Report jinja2 Template Context json

        These are examples of jinja2 static dataset usage. You can access this information from the docx template. Executive reports use jinja for rendering the report, check jinja documentation for more details. methodologies can be used from version 3.12 ...
      • Executive Report

        Intro No more 3AM reporting! The Executive Report feature lets you create (as the name implies) reports using the results obtained in each workspace. When an Executive Report is created, all the data from the Status Report is automatically processed ...
      • Hosts & Services

        How to manage Hosts To manage your Hosts you need to access Faraday's Web UI and click on the Hosts icon:   Here you can create, edit or eliminate Hosts as you wish. Creating Hosts From the Hosts window, click New and fill out the form. Editing Hosts ...
      • Importing information

        This article will help you to learn the different ways that Faraday has to import a report. If you want to know more about our Plugins and available tools from which to import information, check our Plugin List page. Through the Web UI Go to the ...