Skip to content

Remove usage of confidence from `.ordered` scope

What does this MR do and why?

confidence has been deprecated since %15.0. It still isn't fully removed, though we do have an issues to track that123

This MR just removes the usage of confidence in the ordered scope of Vulnerability::Finding model. I am doing this as part of the epic to delete the vulnerability_finding_pipelines table

I need to decouple sbom services from vulnerability_finding_pipelines, and part of that work is improving the query performance of .ordered. Removing confidence from the sort helps, and as it is deprecated anyways this seems like a straightforward quick win

SQL

Example of original scope usage

SELECT
    "vulnerability_occurrences".*
FROM
    "vulnerability_occurrences"
    INNER JOIN "vulnerability_occurrence_pipelines" ON "vulnerability_occurrences"."id" = "vulnerability_occurrence_pipelines"."occurrence_id"
WHERE
    "vulnerability_occurrence_pipelines"."pipeline_id" = 1373855203
    AND "vulnerability_occurrences"."report_type" IN (2, 1)
ORDER BY
    "vulnerability_occurrences"."severity" DESC,
    "vulnerability_occurrences"."confidence" DESC,
    "vulnerability_occurrences"."id" ASC

Example of scope usage after this MR

SELECT
    "vulnerability_occurrences".*
FROM
    "vulnerability_occurrences"
    INNER JOIN "vulnerability_occurrence_pipelines" ON "vulnerability_occurrences"."id" = "vulnerability_occurrence_pipelines"."occurrence_id"
WHERE
    "vulnerability_occurrence_pipelines"."pipeline_id" = 1373855203
    AND "vulnerability_occurrences"."report_type" IN (2, 1)
ORDER BY
    "vulnerability_occurrences"."severity" DESC,
    "vulnerability_occurrences"."id" ASC

MR acceptance checklist

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


Changelog: changed
EE: true
Related to #472760 (closed)


  1. Ignore confidence column on Security::Finding (#458198 - closed) • Michał Zając • 17.3

  2. Ignore confidence columns on Vulnerability (#458197) • Michał Zając • 17.6

  3. Ignore confidence column on Security::Finding (#458198 - closed) • Michał Zając • 17.3

Edited by Michael Becker

Merge request reports

Loading