Skip to content

Convert CWE list to a set for faster lookups

Darby Frey requested to merge cwe-list-set into master

What does this MR do and why?

This MR converts the Vulnerabilities::Finding::HIGH_CONFIDENCE_AI_RESOLUTION_CWES array to a ruby set to improve the lookup time from O(n) to O(1) when calling HIGH_CONFIDENCE_AI_RESOLUTION_CWES.include?(cwe_value&.upcase) in the ai_resolution_available? method.

For reviewers: the ai_resolution_available? method is tested here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/spec/models/vulnerabilities/finding_spec.rb#L1712-1724

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.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Darby Frey

Merge request reports

Loading