Set a Unique ID for Each Finding
This example sets up ID values for each severity category, loops over each finding, and sets a unique ID value based on the finding’s severity. Jinja2 does not support indexing in the destination of aset
block, so this particular use case requires some additional code.
The code uses a namespace to track separate ID values for each severity category. As it loops over each finding, it increments the ID value by one for its severity and creates a finding ID string. The string is the finding’s first tag, the first character of the severity, and the number value (e.g., TAG-C-1
for the first critical finding).
You can customize this example to change the ID string or start ID values at zero instead of one.