Skip to content

Adjust `Security::StoreReportService` to look up findings using UUIDv5, attempt 2

What does this MR do?

Adjusts the logic present in Security::StoreReportService#create_or_find_vulnerability_finding to match the following flowchart so that we use UUIDv5 whenever possible.

image

Query details

Selecting a Vulnerabilities::Finding by UUID

https://postgres.ai/console/gitlab/gitlab-production-tunnel/sessions/1758/commands/5930

Sample query
SELECT * FROM vulnerability_occurrences WHERE project_id = 23762767 AND uuid = '6892fc62-ed64-5494-bb8d-83e418f9deda' LIMIT 1;
Full execution plan
 Limit  (cost=0.56..3.58 rows=1 width=1131) (actual time=15.098..15.099 rows=0 loops=1)
   Buffers: shared read=4
   I/O Timings: read=15.031
   ->  Index Scan using index_vulnerability_occurrences_on_uuid on public.vulnerability_occurrences  (cost=0.56..3.58 rows=1 width=1131) (actual time=15.096..15.097 rows=0 loops=1)
         Index Cond: ((vulnerability_occurrences.uuid)::text = '6892fc62-ed64-5494-bb8d-83e418f9deda'::text)
         Filter: (vulnerability_occurrences.project_id = 23762767)
         Rows Removed by Filter: 0
         Buffers: shared read=4
         I/O Timings: read=15.031
Summary
Time: 15.297 ms
  - planning: 0.167 ms
  - execution: 15.130 ms
    - I/O read: 15.031 ms
    - I/O write: N/A

Shared buffers:
  - hits: 0 from the buffer pool
  - reads: 4 (~32.00 KiB) from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #292236 (closed)

Merge request reports