Ingest tracked context id to vulnerability_statistics table

What does this MR do and why?

This code change adds support for tracking security contexts in vulnerability statistics. The main updates include:

Database Schema Enhancement: The new field security_project_tracked_context_id is ingested to vulnerability statistics tables to link each project's security data to a specific tracking context (like a git branch).

Automatic Context Creation: The system now automatically creates a default security tracking context for projects that don't have one. This context typically tracks the project's main branch and is marked as the default for security monitoring.

Data Migration: Both the adjustment and update services are modified to handle this new field, ensuring that when vulnerability statistics are calculated or updated, they're properly associated with the correct security context.

Testing: New shared test examples are added to verify that the system correctly creates tracking contexts when needed, and existing tests are updated to account for the new field.

The overall goal is to improve how the system tracks and organizes security vulnerability data by associating it with specific project contexts (like different branches), making security monitoring more precise and organized.

References

Relates to - #555984

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rushik Subba

Merge request reports

Loading