You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module manages dynamic grouping of Findings in DefectDojo. Findings can be grouped using different strategies (called GroupModes) such as:
3
+
- Grouping by the vuln_id_from_tool
4
+
- Grouping by the Finding title
5
+
- Grouping by the associated CVE
6
+
7
+
The grouping is user-configurable through the UI and relies on Redis for fast storage and retrieval of groups.
8
+
9
+
## How it works
10
+
When a user selects a grouping mode, the system builds and stores finding groups in Redis. These groups are refreshed automatically whenever new Findings are added or existing ones are modified.
11
+
12
+
### Redis is used to:
13
+
- Store the mapping between Findings and their groups.
14
+
- Store the serialized representation of each DynamicFindingGroups object.
15
+
- Manage timestamps that help us detect if the stored groups are outdated.
16
+
17
+
### Two global keys are important here:
18
+
- finding_groups_last_finding_change: Updated whenever a Finding is created/updated.
19
+
- finding_groups_last_update: Stores the last time a specific GroupMode was rebuilt.
20
+
21
+
### When we rebuild groups:
22
+
Group rebuilding occurs in the following cases:
23
+
- The groups are missing in Redis, or
24
+
- The timestamps `finding_groups_last_finding_change` and `finding_groups_last_update` do not match.
25
+
26
+
In practice, whenever a change occurs, the value of `last_finding_change` becomes more recent than `last_update`. At that point, the groups are rebuilt, and `last_update` is updated to match `last_finding_change`.
27
+
28
+
The `last_update` entry stores the timestamp per mode. Whenever a user opens the tab for a given mode, the system compares the timestamps. If they differ, the groups are rebuilt; otherwise, the existing groups are reused.
29
+
30
+
## Adding a new GroupMode
31
+
To add a new grouping strategy:
32
+
33
+
1. Extend the GroupMode enum. Add a new entry, for example:
34
+
```python
35
+
classGroupMode(StrEnum):
36
+
VULN_ID_FROM_TOOL="vuln_id_from_tool"
37
+
TITLE="title"
38
+
CVE="cve"
39
+
CUSTOM_TAG="custom_tag"# ← New mode
40
+
```
41
+
42
+
2. Update `DynamicFindingGroups.get_group_names`. Define how the Finding should be grouped for the new mode:
0 commit comments