diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/rule_section.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/rule_section.vue index 5af738704260a3101ba8a27b120774ae0268edd2..1351e5d3580543e8e9442e0ec1b607597c281186 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/rule_section.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/rule_section.vue @@ -1,9 +1,11 @@ + + diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/scanners/utils.js b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/scanners/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..1efb50f26b4cbab1bf2f9e0995649a01af68f3f1 --- /dev/null +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/scanners/utils.js @@ -0,0 +1,59 @@ +// scanFiltersUtils.js +import { xor } from 'lodash'; +import { + AGE_TOOLTIP_NO_PREVIOUSLY_EXISTING_VULNERABILITY, + AGE_TOOLTIP_MAXIMUM_REACHED, + DEFAULT_VULNERABILITY_STATES, + NEWLY_DETECTED, + PREVIOUSLY_EXISTING, + FIX_AVAILABLE, + FALSE_POSITIVE, + STATUS, + ATTRIBUTE, +} from 'ee/security_orchestration/components/policy_editor/scan_result/rule/scan_filters/constants'; + +export function normalizeVulnerabilityStates(vulnerabilityStates) { + const states = [ + ...(vulnerabilityStates[NEWLY_DETECTED] || []), + ...(vulnerabilityStates[PREVIOUSLY_EXISTING] || []), + ]; + + if (!states.length) return null; + + const matchesDefault = xor(states, DEFAULT_VULNERABILITY_STATES).length === 0; + + return matchesDefault ? [] : states; +} + +export function updateCombinedFilters(filters) { + return { + ...filters, + [STATUS]: Boolean(filters[NEWLY_DETECTED] && filters[PREVIOUSLY_EXISTING]), + [ATTRIBUTE]: Boolean(filters[FIX_AVAILABLE] && filters[FALSE_POSITIVE]), + }; +} + +export function toggleStatusFilter(filters) { + const nextKey = filters[NEWLY_DETECTED] ? PREVIOUSLY_EXISTING : NEWLY_DETECTED; + + return updateCombinedFilters({ + ...filters, + [nextKey]: true, + }); +} + +export function toggleAttributeFilter(attributes) { + const key = Object.keys(attributes)[0] === FIX_AVAILABLE ? FALSE_POSITIVE : FIX_AVAILABLE; + + return { + ...attributes, + [key]: true, + }; +} + +export function getAgeTooltip(filter, vulnerabilityStates) { + if (!vulnerabilityStates[PREVIOUSLY_EXISTING]?.length) { + return filter.tooltip[AGE_TOOLTIP_NO_PREVIOUSLY_EXISTING_VULNERABILITY]; + } + return filter.tooltip[AGE_TOOLTIP_MAXIMUM_REACHED]; +} diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/security_scan_rule_builder_v2.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/security_scan_rule_builder_v2.vue new file mode 100644 index 0000000000000000000000000000000000000000..fe3e5490408d4ee7b96a964156cc0a6dd0e5b0a9 --- /dev/null +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result/rule/security_scan_rule_builder_v2.vue @@ -0,0 +1,159 @@ + + + diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 0d544087a61cd163bb27b51a7027f7e66865a8f9..984fd2a1ca3334da0f125d4619f87efab22ae611 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -58744,6 +58744,9 @@ msgstr "" msgid "ScanResultPolicy|For scanners that require builds, when a project does not have a build pipeline." msgstr "" +msgid "ScanResultPolicy|Global Settings" +msgstr "" + msgid "ScanResultPolicy|Grant bypass permissions to users based on their organizational role or custom role assignments." msgstr "" @@ -58981,6 +58984,9 @@ msgstr "" msgid "ScanResultPolicy|Service accounts" msgstr "" +msgid "ScanResultPolicy|Severity and status settings will apply to all scan rules" +msgstr "" + msgid "ScanResultPolicy|Severity is:" msgstr "" @@ -59020,6 +59026,9 @@ msgstr "" msgid "ScanResultPolicy|When a %{scanType} with %{scanners} runs against %{branches} %{branchExceptions} and finds %{vulnerabilitiesNumber} %{boldDescription} all the following criteria:" msgstr "" +msgid "ScanResultPolicy|When a %{scanType} with %{scanners} runs against %{branches} %{branchExceptions} and finds %{vulnerabilitiesNumber} vulnerability type that matches all the following criteria:" +msgstr "" + msgid "ScanResultPolicy|When a security policy fails for an unspecified reason." msgstr ""