Skip to content

where

The where function filters an array, keeping only the items for which a given expression evaluates to true. The expression is evaluated once per item, with that item as its scope, so you can reference each item’s own fields by name.

{input | where:"expression"}
  • input (array): The array to filter, for example vulnerabilities, affected_hosts, or categories.
  • expression (string): An expression evaluated for each item; the item is kept when the result is truthy. The item’s properties are available by name. Supports comparisons (===, !==, ==, !=, >, >=, <, <=), logical operators (&&, ||, !), and property access (remediation_stage, cvss_score, extra_fields['Summary']).
  • A new array containing only the items for which the expression evaluated to true.
  • The original array is not modified.
  • If no items match, an empty array is returned (a loop over it renders nothing; pipe the result to isNotEmpty to get a true/false value).

Keep only vulnerabilities that are not remediated

Section titled “Keep only vulnerabilities that are not remediated”
{vulnerabilities | where:"remediation_stage !== 'completed'"}
// Input: [{"title": "SQLi", "remediation_stage": "completed"}, {"title": "XSS", "remediation_stage": "in_progress"}, {"title": "CSRF", "remediation_stage": null}]
// Returns: [{"title": "XSS", "remediation_stage": "in_progress"}, {"title": "CSRF", "remediation_stage": null}]

Keep only vulnerabilities currently being retested

Section titled “Keep only vulnerabilities currently being retested”
{vulnerabilities | where:"remediation_stage === 'in_progress'"}
{vulnerabilities | where:"cvss_score >= 7"}
{vulnerabilities | where:"cvss_score >= 7 && remediation_stage !== 'completed'"}
{vulnerabilities | where:"extra_fields['Summary'] === 'Reflected'"}
{#vulnerabilities | where:"remediation_stage !== 'completed'"}#{order_id} {title}{/}

Show a section only when matching items exist (with isNotEmpty)

Section titled “Show a section only when matching items exist (with isNotEmpty)”
{#(vulnerabilities | where:"remediation_stage !== 'completed'" | isNotEmpty)}
The following vulnerabilities are still active:
{#vulnerabilities | where:"remediation_stage !== 'completed'"}#{order_id} {title} - {~extra_fields['Summary']}{/}
{/}
  • Use straight quotes (" and '), not the “smart quotes” a word processor inserts automatically. Smart quotes break the expression.
  • where operates on arrays. Applying it to a value that is not an array leaves the tag unrendered.
  • Wrap the expression in double quotes and use single quotes for string values inside it, as in the examples.
  • remediation_stage values are completed (Remediated), in_progress (Retesting), requested, partial, and null (Not Remediated). “Not remediated” means anything other than completed.
  • Listing only unresolved (not remediated) findings in a summary section
  • Building severity-specific tables (for example, only High/Critical by CVSS)
  • Driving conditional sections together with isNotEmpty
  • Narrowing any repeated list (hosts, categories, findings) to a subset before looping