About Deduplication | DefectDojo Documentation

About Deduplication

DefectDojo is designed to ingest bulk reports from tools, creating one or more Findings based on the content of the report. When using DefectDojo, you’ll most likely be ingesting reports from the same tool on a regular basis, which means that duplicate Findings are highly likely.

This is where Deduplication comes in, a Smart feature which you can set up to automatically manage duplicate Findings.

How DefectDojo handles duplicates

  1. First, you import Test 1. Your report contains a vulnerability which is recorded as Finding A.
  2. Later, you import Test 2 which contains the same vulnerability. This will be recorded as Finding B, and Finding B will be marked as a duplicate of Finding A.
  3. Later still, you import Test 3 which also contains that vulnerability. This will be recorded as Finding C, which will be marked as a duplicate of Finding A.

By creating and marking Duplicates in this way, DefectDojo ensures that all the work for the ‘original’ vulnerability is centralized on the original Finding page, without creating separate contexts, or giving your team the impression that there are multiple separate vulnerabilities which need to be addressed.

By default, these Tests would need to be nested under the same Product for Deduplication to be applied. If you wish, you can further limit the Deduplication scope to a single Engagement.

Duplicate Findings are set as Inactive by default. This does not mean the Duplicate Finding itself is Inactive. Rather, this is so that your team only has a single active Finding to work on and remediate, with the implication being that once the original Finding is Mitigated, the Duplicates will also be Mitigated.

Reimport Deduplication

Deduplication and Reimport are similar processes, but they use different algorithms to identify Finding matches.

However, any Findings that remain after Reimport Deduplication are still subject to Same-Tool Deduplication. So if you use narrower a scope for Same-Tool Deduplication, you can end up with Duplicates within a Reimport pipeline.

Example

Here’s a tool with a Reimport Deduplication algorithm which is different from the Same-Tool Deduplication algorithm.

Deduplication Algorithm Hash Code Fields
Reimport Title, CWE, Severity, Description, Line Number
Same-Tool Title, CWE, Severity, Description

Let’s say you had a Finding in DefectDojo with a given line number. You re-scanned your environment and the line number of that vulnerability changed. You reimport to the same Test. Here’s what will happen during reimport, and deduplication:

Reimport can completely discard Findings before they are recorded, so Reimport Deduplication settings should be adjusted with caution.

When are duplicates appropriate?

Duplicates are useful when you’re dealing with shared, but discrete Testing contexts. For example, if your Product is uploading Test results for two different repositories, which need to be compared, it’s useful to know which vulnerabilities are shared across those repositories.

However, if DefectDojo is creating excess duplicates, this can also be a sign that you need to adjust your pipelines or import processes.

What do my duplicates indicate?

Overview

DefectDojo supports four deduplication algorithms that can be selected per parser (test type):

How endpoints are assessed per algorithm

Endpoints can influence deduplication in different ways depending on the algorithm and configuration.

Unique ID From Tool

Hash Code

Unique ID From Tool or Hash Code

A finding is a duplicate with another if they have the same unique_id_from_tool OR the same hash_code.

The endpoints also have to match for the findings to be considered duplicates, see the Hash Code algorithm above.

Legacy (Open Source only)

Background processing

Import/reimport deduplication execution mode

For import and reimport you can control how deduplication post-processing is dispatched and whether the API response waits for it. Set it per user on the profile page ( Deduplication execution mode), or override it per request with the deduplication_execution_mode field on the import/reimport endpoints (the request value takes precedence over the profile).

The import/reimport response includes a deduplication_complete boolean indicating whether deduplication had finished by the time the response was produced (true for sync and for a completed async_wait, false for async).

This is independent of the global block_execution profile flag, which forces all of a user’s asynchronous tasks (notifications, JIRA push, product grading, deduplication, …) to the foreground. When no execution mode is set, block_execution=True falls back to sync.

Service field and its impact

Delete Deduplicate Findings

If you have an excessive amount of duplicate Findings which you want to delete, you can set Delete Deduplicate Findings as an option in the System Settings.

Delete Deduplicate Findings, combined with the Maximum Duplicates field allows DefectDojo to limit the amount of Duplicate Findings stored. When this field is enabled, DefectDojo will only keep a certain number of Duplicate Findings.

Which duplicates will be deleted?

The original Finding will never be deleted automatically from DefectDojo, but once the threshold for Maximum Duplicates is crossed, DefectDojo will automatically delete the oldest Duplicate Finding.

For example, let’s say that you had your Maximum Duplicates field set to ‘1’.

  1. First, you import Test 1. Your report contains a vulnerability which is recorded as Finding A.
  2. Later, you import Test 2 contains the same vulnerability. This will be recorded as Finding B, and Finding B will be marked as a duplicate of Finding A.
  3. Later still, you import Test 3 which also contains that vulnerability. This will be recorded as Finding C, which will be marked as a duplicate of Finding A. At this time, Finding B will be deleted from DefectDojo as the threshold for maximum duplicates has been crossed.

Applying this setting

Applying Delete Deduplicate Findings will begin a deletion process immediately. This setting can be applied on the System Settings page. See Enabling Deduplication for more information.

Troubleshooting Deduplication

Sometimes, Deduplication does not work as expected. Here are some examples of ways that Deduplication might not be working correctly, along with possible solutions.

What you see Most likely cause What to tune
Reimport closes an old Finding and creates a new one when only the line number changed Reimport matching uses unstable fields (for example, line number) Reimport Deduplication (prefer stable IDs or stable hash fields)
Multiple Findings are created in the same Test that you believe should be duplicates Deduplication matching is not configured for that tool or scope Same Tool Deduplication (and consider “Delete Deduplicate Findings” behavior)
Duplicates are created across different tools Cross-tool matching is disabled or too strict Cross Tool Deduplication (Pro only) (hash-based matching)
The same SCA dependency imported into multiple Products creates separate Findings instead of duplicates Deduplication is scoped per Product by default Global Component Deduplication (Pro only) ( enable for your SCA tools)
Excess duplicates of the same Finding are being created, across Tests Asset Hierarchy is not set up correctly Consider Reimport for continual testing

When automatic deduplication misses Findings that you believe belong together, you can link them by hand from the View Finding page. See Similar Findings for how to discover related Findings and mark them as duplicates manually.