Add due date filter to vulnerability GraphQL APIs

What does this MR do and why?

  • Adds dueDateAfter, dueDateBefore and dueDateWildcard (NONE, ANY) to the project and group vulnerabilities and vulnerabilitySeveritiesCount GraphQL fields, so the Vulnerability Report can filter by due date.
  • They're served from Elasticsearch, behind the vulnerability_due_date_filter flag (default off), and only once the BackfillDueDateInVulnerabilities migration from !266732 (merged) has finished.
  • API only. The token is in !266734.

Closes #638049. Design notes are in the issue. Rollout: #639350.

How to test

Requires Elasticsearch in GDK with advanced vulnerability management, and the BackfillDueDateInVulnerabilities migration finished.

  1. Feature.enable(:vulnerability_due_date_filter)

  2. Set due dates on a few vulnerabilities in a project.

  3. In GraphiQL:

    {
      project(fullPath: "<path>") {
        overdue: vulnerabilities(dueDateBefore: "2026-10-29") { nodes { id dueDate } }
        none: vulnerabilities(dueDateWildcard: NONE) { count }
        any: vulnerabilities(dueDateWildcard: ANY) { nodes { id dueDate } }
      }
    }
  4. Run the same queries on group(fullPath:).

  5. Disable the flag and check that the arguments return The due date filter is not available.

Arguments
Argument Type Meaning
dueDateAfter Date Due on or after this date
dueDateBefore Date Due on or before this date
dueDateWildcard VulnerabilityDueDateWildcardId (NONE, ANY) Has no due date, or has one

dueDateWildcard can't be combined with a date.

GDK verification

On gitlab-org/gitlab with due dates on Oct 20, Oct 31, Nov 4, Nov 20 and Dec 20 (plus Dec 22 on one other vulnerability):

Query Result
dueDateBefore: "2026-10-29" Oct 20 only
dueDateAfter: "2026-10-30", dueDateBefore: "2026-11-06" Oct 31 and Nov 4
dueDateAfter: "2026-11-30" Dec 20 and Dec 22
dueDateWildcard: ANY all six
dueDateWildcard: NONE only vulnerabilities without a due date
vulnerabilitySeveritiesCount(dueDateWildcard: ANY) 4 critical, 2 high
dueDateWildcard: NONE, dueDateAfter: "2026-10-01" dueDateWildcard cannot be combined with dueDateAfter or dueDateBefore.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

🤖 Generated with Claude Code

Edited by AJ Biton

Merge request reports

Loading
Loading