Commit e0bd8382 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '295252-remove-dast-saved-scans-ff' into 'master'

Remove dast_saved_scans feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!56540
parents b77a2f73 2cfd0c6f
...@@ -4667,7 +4667,7 @@ An edge in a connection. ...@@ -4667,7 +4667,7 @@ An edge in a connection.
| `containerRepositories` | [`ContainerRepositoryConnection`](#containerrepositoryconnection) | Container repositories of the project. | | `containerRepositories` | [`ContainerRepositoryConnection`](#containerrepositoryconnection) | Container repositories of the project. |
| `containerRepositoriesCount` | [`Int!`](#int) | Number of container repositories in the project. | | `containerRepositoriesCount` | [`Int!`](#int) | Number of container repositories in the project. |
| `createdAt` | [`Time`](#time) | Timestamp of the project creation. | | `createdAt` | [`Time`](#time) | Timestamp of the project creation. |
| `dastProfiles` | [`DastProfileConnection`](#dastprofileconnection) | DAST Profiles associated with the project. Always returns no nodes if `dast_saved_scans` is disabled. | | `dastProfiles` | [`DastProfileConnection`](#dastprofileconnection) | DAST Profiles associated with the project. |
| `dastScannerProfiles` | [`DastScannerProfileConnection`](#dastscannerprofileconnection) | The DAST scanner profiles associated with the project. | | `dastScannerProfiles` | [`DastScannerProfileConnection`](#dastscannerprofileconnection) | The DAST scanner profiles associated with the project. |
| `dastSiteProfile` | [`DastSiteProfile`](#dastsiteprofile) | DAST Site Profile associated with the project. | | `dastSiteProfile` | [`DastSiteProfile`](#dastsiteprofile) | DAST Site Profile associated with the project. |
| `dastSiteProfiles` | [`DastSiteProfileConnection`](#dastsiteprofileconnection) | DAST Site Profiles associated with the project. | | `dastSiteProfiles` | [`DastSiteProfileConnection`](#dastsiteprofileconnection) | DAST Site Profiles associated with the project. |
......
...@@ -28,7 +28,6 @@ import { REF_TYPE_BRANCHES } from '~/ref/constants'; ...@@ -28,7 +28,6 @@ import { REF_TYPE_BRANCHES } from '~/ref/constants';
import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
import validation from '~/vue_shared/directives/validation'; import validation from '~/vue_shared/directives/validation';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import dastOnDemandScanCreateMutation from '../graphql/dast_on_demand_scan_create.mutation.graphql';
import dastProfileCreateMutation from '../graphql/dast_profile_create.mutation.graphql'; import dastProfileCreateMutation from '../graphql/dast_profile_create.mutation.graphql';
import dastProfileUpdateMutation from '../graphql/dast_profile_update.mutation.graphql'; import dastProfileUpdateMutation from '../graphql/dast_profile_update.mutation.graphql';
import { import {
...@@ -140,8 +139,7 @@ export default { ...@@ -140,8 +139,7 @@ export default {
}, },
}, },
data() { data() {
const savedScansFields = this.glFeatures.dastSavedScans return {
? {
form: { form: {
showValidation: false, showValidation: false,
state: false, state: false,
...@@ -154,10 +152,6 @@ export default { ...@@ -154,10 +152,6 @@ export default {
}), }),
}, },
}, },
}
: {};
return {
...savedScansFields,
scannerProfiles: [], scannerProfiles: [],
siteProfiles: [], siteProfiles: [],
selectedBranch: this.dastScan?.branch?.name ?? this.defaultBranch, selectedBranch: this.dastScan?.branch?.name ?? this.defaultBranch,
...@@ -179,11 +173,6 @@ export default { ...@@ -179,11 +173,6 @@ export default {
? s__('OnDemandScans|Edit on-demand DAST scan') ? s__('OnDemandScans|Edit on-demand DAST scan')
: s__('OnDemandScans|New on-demand DAST scan'); : s__('OnDemandScans|New on-demand DAST scan');
}, },
manageProfilesLabel() {
return this.glFeatures.dastSavedScans
? s__('OnDemandScans|Manage DAST scans')
: s__('OnDemandScans|Manage profiles');
},
selectedScannerProfile() { selectedScannerProfile() {
return this.selectedScannerProfileId return this.selectedScannerProfileId
? this.scannerProfiles.find(({ id }) => id === this.selectedScannerProfileId) ? this.scannerProfiles.find(({ id }) => id === this.selectedScannerProfileId)
...@@ -256,32 +245,23 @@ export default { ...@@ -256,32 +245,23 @@ export default {
}, },
methods: { methods: {
onSubmit({ runAfter = true, button = this.$options.saveAndRunScanBtnId } = {}) { onSubmit({ runAfter = true, button = this.$options.saveAndRunScanBtnId } = {}) {
if (this.glFeatures.dastSavedScans) {
this.form.showValidation = true; this.form.showValidation = true;
if (!this.form.state) { if (!this.form.state) {
return; return;
} }
}
this.loading = button; this.loading = button;
this.hideErrors(); this.hideErrors();
let mutation = dastOnDemandScanCreateMutation; const mutation = this.isEdit ? dastProfileUpdateMutation : dastProfileCreateMutation;
let responseType = 'dastOnDemandScanCreate'; const responseType = this.isEdit ? 'dastProfileUpdate' : 'dastProfileCreate';
let input = { const input = {
fullPath: this.projectPath, fullPath: this.projectPath,
dastScannerProfileId: this.selectedScannerProfile.id, dastScannerProfileId: this.selectedScannerProfile.id,
dastSiteProfileId: this.selectedSiteProfile.id, dastSiteProfileId: this.selectedSiteProfile.id,
};
if (this.glFeatures.dastSavedScans) {
mutation = this.isEdit ? dastProfileUpdateMutation : dastProfileCreateMutation;
responseType = this.isEdit ? 'dastProfileUpdate' : 'dastProfileCreate';
input = {
...input,
...(this.isEdit ? { id: this.dastScan.id } : {}), ...(this.isEdit ? { id: this.dastScan.id } : {}),
...serializeFormObject(this.form.fields), ...serializeFormObject(this.form.fields),
[this.isEdit ? 'runAfterUpdate' : 'runAfterCreate']: runAfter, [this.isEdit ? 'runAfterUpdate' : 'runAfterCreate']: runAfter,
}; };
}
if (this.glFeatures.dastBranchSelection) { if (this.glFeatures.dastBranchSelection) {
input.branchName = this.selectedBranch; input.branchName = this.selectedBranch;
} }
...@@ -299,7 +279,7 @@ export default { ...@@ -299,7 +279,7 @@ export default {
if (errors?.length) { if (errors?.length) {
this.showErrors(ERROR_RUN_SCAN, errors); this.showErrors(ERROR_RUN_SCAN, errors);
this.loading = false; this.loading = false;
} else if (this.glFeatures.dastSavedScans && !runAfter) { } else if (!runAfter) {
redirectTo(response.dastProfile.editPath); redirectTo(response.dastProfile.editPath);
this.clearStorage = true; this.clearStorage = true;
} else { } else {
...@@ -345,7 +325,7 @@ export default { ...@@ -345,7 +325,7 @@ export default {
<template> <template>
<gl-form novalidate @submit.prevent="onSubmit()"> <gl-form novalidate @submit.prevent="onSubmit()">
<local-storage-sync <local-storage-sync
v-if="glFeatures.dastSavedScans && !isEdit" v-if="!isEdit"
as-json as-json
:storage-key="$options.ON_DEMAND_SCANS_STORAGE_KEY" :storage-key="$options.ON_DEMAND_SCANS_STORAGE_KEY"
:clear="clearStorage" :clear="clearStorage"
...@@ -356,7 +336,7 @@ export default { ...@@ -356,7 +336,7 @@ export default {
<div class="gl-mt-6 gl-display-flex"> <div class="gl-mt-6 gl-display-flex">
<h2 class="gl-flex-grow-1 gl-my-0">{{ title }}</h2> <h2 class="gl-flex-grow-1 gl-my-0">{{ title }}</h2>
<gl-button :href="profilesLibraryPath" data-testid="manage-profiles-link"> <gl-button :href="profilesLibraryPath" data-testid="manage-profiles-link">
{{ manageProfilesLabel }} {{ s__('OnDemandScans|Manage DAST scans') }}
</gl-button> </gl-button>
</div> </div>
<p> <p>
...@@ -391,7 +371,7 @@ export default { ...@@ -391,7 +371,7 @@ export default {
</gl-alert> </gl-alert>
<template v-if="isLoadingProfiles"> <template v-if="isLoadingProfiles">
<gl-skeleton-loader v-if="glFeatures.dastSavedScans" :width="1248" :height="180"> <gl-skeleton-loader :width="1248" :height="180">
<rect x="0" y="0" width="100" height="15" rx="4" /> <rect x="0" y="0" width="100" height="15" rx="4" />
<rect x="0" y="24" width="460" height="32" rx="4" /> <rect x="0" y="24" width="460" height="32" rx="4" />
<rect x="0" y="71" width="100" height="15" rx="4" /> <rect x="0" y="71" width="100" height="15" rx="4" />
...@@ -412,7 +392,6 @@ export default { ...@@ -412,7 +392,6 @@ export default {
</gl-card> </gl-card>
</template> </template>
<template v-else-if="!failedToLoadProfiles"> <template v-else-if="!failedToLoadProfiles">
<template v-if="glFeatures.dastSavedScans">
<gl-form-group <gl-form-group
:label="s__('OnDemandScans|Scan name')" :label="s__('OnDemandScans|Scan name')"
:invalid-feedback="form.fields.name.feedback" :invalid-feedback="form.fields.name.feedback"
...@@ -438,7 +417,6 @@ export default { ...@@ -438,7 +417,6 @@ export default {
:state="form.fields.description.state" :state="form.fields.description.state"
/> />
</gl-form-group> </gl-form-group>
</template>
<gl-form-group v-if="glFeatures.dastBranchSelection" :label="__('Branch')"> <gl-form-group v-if="glFeatures.dastBranchSelection" :label="__('Branch')">
<ref-selector <ref-selector
...@@ -574,14 +552,9 @@ export default { ...@@ -574,14 +552,9 @@ export default {
:disabled="isSubmitButtonDisabled" :disabled="isSubmitButtonDisabled"
:loading="loading === $options.saveAndRunScanBtnId" :loading="loading === $options.saveAndRunScanBtnId"
> >
{{ {{ s__('OnDemandScans|Save and run scan') }}
glFeatures.dastSavedScans
? s__('OnDemandScans|Save and run scan')
: s__('OnDemandScans|Run scan')
}}
</gl-button> </gl-button>
<gl-button <gl-button
v-if="glFeatures.dastSavedScans"
variant="success" variant="success"
category="secondary" category="secondary"
data-testid="on-demand-scan-save-button" data-testid="on-demand-scan-save-button"
......
mutation dastOnDemandScanCreate($input: DastOnDemandScanCreateInput!) {
dastOnDemandScanCreate(input: $input) {
pipelineUrl
errors
}
}
...@@ -39,7 +39,6 @@ export default { ...@@ -39,7 +39,6 @@ export default {
return getProfileSettings({ return getProfileSettings({
createNewProfilePaths, createNewProfilePaths,
isDastSavedScansEnabled: this.glFeatures.dastSavedScans,
}); });
}, },
tabIndex: { tabIndex: {
......
...@@ -10,9 +10,7 @@ import dastSiteProfilesQuery from 'ee/security_configuration/dast_profiles/graph ...@@ -10,9 +10,7 @@ import dastSiteProfilesQuery from 'ee/security_configuration/dast_profiles/graph
import dastSiteProfilesDelete from 'ee/security_configuration/dast_profiles/graphql/dast_site_profiles_delete.mutation.graphql'; import dastSiteProfilesDelete from 'ee/security_configuration/dast_profiles/graphql/dast_site_profiles_delete.mutation.graphql';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
export const getProfileSettings = ({ createNewProfilePaths, isDastSavedScansEnabled }) => ({ export const getProfileSettings = ({ createNewProfilePaths }) => ({
...(isDastSavedScansEnabled
? {
dastProfiles: { dastProfiles: {
profileType: 'dastProfiles', profileType: 'dastProfiles',
createNewProfilePath: createNewProfilePaths.savedScan, createNewProfilePath: createNewProfilePaths.savedScan,
...@@ -56,8 +54,6 @@ export const getProfileSettings = ({ createNewProfilePaths, isDastSavedScansEnab ...@@ -56,8 +54,6 @@ export const getProfileSettings = ({ createNewProfilePaths, isDastSavedScansEnab
noProfilesMessage: s__('DastProfiles|No scans saved yet'), noProfilesMessage: s__('DastProfiles|No scans saved yet'),
}, },
}, },
}
: {}),
siteProfiles: { siteProfiles: {
profileType: 'siteProfiles', profileType: 'siteProfiles',
createNewProfilePath: createNewProfilePaths.siteProfile, createNewProfilePath: createNewProfilePaths.siteProfile,
......
...@@ -6,7 +6,6 @@ module Projects ...@@ -6,7 +6,6 @@ module Projects
before_action do before_action do
push_frontend_feature_flag(:security_dast_site_profiles_additional_fields, @project, default_enabled: :yaml) push_frontend_feature_flag(:security_dast_site_profiles_additional_fields, @project, default_enabled: :yaml)
push_frontend_feature_flag(:dast_saved_scans, @project, default_enabled: :yaml)
push_frontend_feature_flag(:dast_branch_selection, @project, default_enabled: :yaml) push_frontend_feature_flag(:dast_branch_selection, @project, default_enabled: :yaml)
end end
...@@ -19,12 +18,9 @@ module Projects ...@@ -19,12 +18,9 @@ module Projects
end end
def new def new
not_found unless Feature.enabled?(:dast_saved_scans, @project, default_enabled: :yaml)
end end
def edit def edit
not_found unless Feature.enabled?(:dast_saved_scans, @project, default_enabled: :yaml)
dast_profile = Dast::ProfilesFinder.new(project_id: @project.id, id: params[:id]).execute.first! # rubocop: disable CodeReuse/ActiveRecord dast_profile = Dast::ProfilesFinder.new(project_id: @project.id, id: params[:id]).execute.first! # rubocop: disable CodeReuse/ActiveRecord
@dast_profile = { @dast_profile = {
......
...@@ -7,7 +7,6 @@ module Projects ...@@ -7,7 +7,6 @@ module Projects
before_action do before_action do
authorize_read_on_demand_scans! authorize_read_on_demand_scans!
push_frontend_feature_flag(:dast_saved_scans, @project, default_enabled: :yaml)
push_frontend_feature_flag(:dast_failed_site_validations, @project, default_enabled: :yaml) push_frontend_feature_flag(:dast_failed_site_validations, @project, default_enabled: :yaml)
push_frontend_feature_flag(:dast_branch_selection, @project, default_enabled: :yaml) push_frontend_feature_flag(:dast_branch_selection, @project, default_enabled: :yaml)
end end
......
...@@ -59,8 +59,7 @@ module EE ...@@ -59,8 +59,7 @@ module EE
field :dast_profiles, field :dast_profiles,
::Types::Dast::ProfileType.connection_type, ::Types::Dast::ProfileType.connection_type,
null: true, null: true,
description: 'DAST Profiles associated with the project. Always returns no nodes ' \ description: 'DAST Profiles associated with the project.'
'if `dast_saved_scans` is disabled.'
field :dast_site_profile, field :dast_site_profile,
::Types::DastSiteProfileType, ::Types::DastSiteProfileType,
...@@ -152,8 +151,6 @@ module EE ...@@ -152,8 +151,6 @@ module EE
end end
def dast_profiles def dast_profiles
return Dast::Profile.none unless ::Feature.enabled?(:dast_saved_scans, object, default_enabled: :yaml)
Dast::ProfilesFinder.new(project_id: object.id).execute Dast::ProfilesFinder.new(project_id: object.id).execute
end end
......
...@@ -83,8 +83,7 @@ module Mutations ...@@ -83,8 +83,7 @@ module Mutations
private private
def allowed?(project) def allowed?(project)
project.feature_available?(:security_on_demand_scans) && project.feature_available?(:security_on_demand_scans)
Feature.enabled?(:dast_saved_scans, project, default_enabled: :yaml)
end end
def feature_flagged_branch_name(project, branch_name) def feature_flagged_branch_name(project, branch_name)
......
...@@ -16,7 +16,6 @@ module Mutations ...@@ -16,7 +16,6 @@ module Mutations
def resolve(id:) def resolve(id:)
dast_profile = authorized_find!(id) dast_profile = authorized_find!(id)
raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless enabled?(dast_profile.project)
response = ::Dast::Profiles::DestroyService.new( response = ::Dast::Profiles::DestroyService.new(
container: dast_profile.project, container: dast_profile.project,
...@@ -29,10 +28,6 @@ module Mutations ...@@ -29,10 +28,6 @@ module Mutations
private private
def enabled?(project)
Feature.enabled?(:dast_saved_scans, project, default_enabled: :yaml)
end
def find_object(id) def find_object(id)
# TODO: remove this line when the compatibility layer is removed # TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
......
...@@ -45,8 +45,7 @@ module Mutations ...@@ -45,8 +45,7 @@ module Mutations
private private
def allowed?(project) def allowed?(project)
project.feature_available?(:security_on_demand_scans) && project.feature_available?(:security_on_demand_scans)
Feature.enabled?(:dast_saved_scans, project, default_enabled: :yaml)
end end
def find_dast_profile(project, id) def find_dast_profile(project, id)
......
...@@ -88,8 +88,7 @@ module Mutations ...@@ -88,8 +88,7 @@ module Mutations
private private
def allowed?(project) def allowed?(project)
project.feature_available?(:security_on_demand_scans) && project.feature_available?(:security_on_demand_scans)
Feature.enabled?(:dast_saved_scans, project, default_enabled: :yaml)
end end
def as_model_id(klass, value) def as_model_id(klass, value)
......
...@@ -39,8 +39,7 @@ module Dast ...@@ -39,8 +39,7 @@ module Dast
private private
def allowed? def allowed?
container.feature_available?(:security_on_demand_scans) && container.feature_available?(:security_on_demand_scans)
Feature.enabled?(:dast_saved_scans, container, default_enabled: :yaml)
end end
def dast_site_profile def dast_site_profile
......
...@@ -14,7 +14,6 @@ module Dast ...@@ -14,7 +14,6 @@ module Dast
private private
def allowed? def allowed?
Feature.enabled?(:dast_saved_scans, container, default_enabled: :yaml) &&
can?(current_user, :create_on_demand_dast_scan, container) can?(current_user, :create_on_demand_dast_scan, container)
end end
......
...@@ -23,7 +23,6 @@ module Dast ...@@ -23,7 +23,6 @@ module Dast
def allowed? def allowed?
container.feature_available?(:security_on_demand_scans) && container.feature_available?(:security_on_demand_scans) &&
Feature.enabled?(:dast_saved_scans, container, default_enabled: :yaml) &&
can?(current_user, :create_on_demand_dast_scan, container) can?(current_user, :create_on_demand_dast_scan, container)
end end
......
- on_demand_scans_path = Feature.enabled?(:dast_saved_scans, @project, default_enabled: :yaml) ? new_project_on_demand_scan_path(@project) : project_on_demand_scans_path(@project) - on_demand_scans_path = new_project_on_demand_scan_path(@project)
- if any_project_nav_tab?([:security, :security_configuration, :dependencies, :licenses, :audit_events]) - if any_project_nav_tab?([:security, :security_configuration, :dependencies, :licenses, :audit_events])
= nav_link(path: sidebar_security_paths) do = nav_link(path: sidebar_security_paths) do
......
...@@ -9,4 +9,4 @@ scanner_profile: { id: @scanner_profile.to_global_id.to_s, name: @scanner_profil ...@@ -9,4 +9,4 @@ scanner_profile: { id: @scanner_profile.to_global_id.to_s, name: @scanner_profil
spider_timeout: @scanner_profile.spider_timeout, target_timeout: @scanner_profile.target_timeout, spider_timeout: @scanner_profile.spider_timeout, target_timeout: @scanner_profile.target_timeout,
scan_type: @scanner_profile.scan_type.upcase, use_ajax_spider: @scanner_profile.use_ajax_spider, scan_type: @scanner_profile.scan_type.upcase, use_ajax_spider: @scanner_profile.use_ajax_spider,
show_debug_messages: @scanner_profile.show_debug_messages, referenced_in_security_policies: @scanner_profile.referenced_in_security_policies }.to_json, show_debug_messages: @scanner_profile.show_debug_messages, referenced_in_security_policies: @scanner_profile.referenced_in_security_policies }.to_json,
on_demand_scans_path: Feature.enabled?(:dast_saved_scans, @project, default_enabled: :yaml) ? new_project_on_demand_scan_path(@project) : project_on_demand_scans_path(@project) } } on_demand_scans_path: new_project_on_demand_scan_path(@project) } }
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
.js-dast-scanner-profile-form{ data: { project_full_path: @project.path_with_namespace, .js-dast-scanner-profile-form{ data: { project_full_path: @project.path_with_namespace,
profiles_library_path: project_security_configuration_dast_profiles_path(@project, anchor: 'scanner-profiles'), profiles_library_path: project_security_configuration_dast_profiles_path(@project, anchor: 'scanner-profiles'),
on_demand_scans_path: Feature.enabled?(:dast_saved_scans, @project, default_enabled: :yaml) ? new_project_on_demand_scan_path(@project) : project_on_demand_scans_path(@project) } } on_demand_scans_path: new_project_on_demand_scan_path(@project) } }
...@@ -8,4 +8,4 @@ profiles_library_path: project_security_configuration_dast_profiles_path(@projec ...@@ -8,4 +8,4 @@ profiles_library_path: project_security_configuration_dast_profiles_path(@projec
site_profile: { id: @site_profile.to_global_id.to_s, name: @site_profile.name, target_url: @site_profile.dast_site.url, site_profile: { id: @site_profile.to_global_id.to_s, name: @site_profile.name, target_url: @site_profile.dast_site.url,
excluded_urls: 'https://example.com/logout', request_headers: 'new-header', excluded_urls: 'https://example.com/logout', request_headers: 'new-header',
auth: { enabled: true, url: 'https://example.com', username: 'admin', usernameField: 'username', passwordField: 'password' }, referenced_in_security_policies: @site_profile.referenced_in_security_policies}.to_json, auth: { enabled: true, url: 'https://example.com', username: 'admin', usernameField: 'username', passwordField: 'password' }, referenced_in_security_policies: @site_profile.referenced_in_security_policies}.to_json,
on_demand_scans_path: Feature.enabled?(:dast_saved_scans, @project, default_enabled: :yaml) ? new_project_on_demand_scan_path(@project) : project_on_demand_scans_path(@project) } } on_demand_scans_path: new_project_on_demand_scan_path(@project) } }
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
.js-dast-site-profile-form{ data: { full_path: @project.path_with_namespace, .js-dast-site-profile-form{ data: { full_path: @project.path_with_namespace,
profiles_library_path: project_security_configuration_dast_profiles_path(@project, anchor: 'site-profiles'), profiles_library_path: project_security_configuration_dast_profiles_path(@project, anchor: 'site-profiles'),
on_demand_scans_path: Feature.enabled?(:dast_saved_scans, @project, default_enabled: :yaml) ? new_project_on_demand_scan_path(@project) : project_on_demand_scans_path(@project) } } on_demand_scans_path: new_project_on_demand_scan_path(@project) } }
---
title: Remove the dast_saved_scans feature flag
merge_request: 56540
author:
type: removed
---
name: dast_saved_scans
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50469
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/295252
milestone: '13.8'
type: development
group: group::dynamic analysis
default_enabled: true
...@@ -5,7 +5,6 @@ import VueApollo from 'vue-apollo'; ...@@ -5,7 +5,6 @@ import VueApollo from 'vue-apollo';
import OnDemandScansForm from 'ee/on_demand_scans/components/on_demand_scans_form.vue'; import OnDemandScansForm from 'ee/on_demand_scans/components/on_demand_scans_form.vue';
import ScannerProfileSelector from 'ee/on_demand_scans/components/profile_selector/scanner_profile_selector.vue'; import ScannerProfileSelector from 'ee/on_demand_scans/components/profile_selector/scanner_profile_selector.vue';
import SiteProfileSelector from 'ee/on_demand_scans/components/profile_selector/site_profile_selector.vue'; import SiteProfileSelector from 'ee/on_demand_scans/components/profile_selector/site_profile_selector.vue';
import dastOnDemandScanCreateMutation from 'ee/on_demand_scans/graphql/dast_on_demand_scan_create.mutation.graphql';
import dastProfileCreateMutation from 'ee/on_demand_scans/graphql/dast_profile_create.mutation.graphql'; import dastProfileCreateMutation from 'ee/on_demand_scans/graphql/dast_profile_create.mutation.graphql';
import dastProfileUpdateMutation from 'ee/on_demand_scans/graphql/dast_profile_update.mutation.graphql'; import dastProfileUpdateMutation from 'ee/on_demand_scans/graphql/dast_profile_update.mutation.graphql';
import dastScannerProfilesQuery from 'ee/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql'; import dastScannerProfilesQuery from 'ee/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql';
...@@ -152,7 +151,6 @@ describe('OnDemandScansForm', () => { ...@@ -152,7 +151,6 @@ describe('OnDemandScansForm', () => {
newScannerProfilePath, newScannerProfilePath,
newSiteProfilePath, newSiteProfilePath,
glFeatures: { glFeatures: {
dastSavedScans: true,
dastBranchSelection: true, dastBranchSelection: true,
}, },
}, },
...@@ -464,38 +462,6 @@ describe('OnDemandScansForm', () => { ...@@ -464,38 +462,6 @@ describe('OnDemandScansForm', () => {
}); });
}); });
describe('dastSavedScans feature flag disabled', () => {
beforeEach(async () => {
mountShallowSubject({
provide: {
glFeatures: {
dastSavedScans: false,
},
},
});
subject.vm.$apollo.mutate.mockResolvedValue({
data: { dastOnDemandScanCreate: { pipelineUrl, errors: [] } },
});
subject.find(ScannerProfileSelector).vm.$emit('input', passiveScannerProfile.id);
subject.find(SiteProfileSelector).vm.$emit('input', nonValidatedSiteProfile.id);
submitForm();
});
it('triggers GraphQL mutation', () => {
expect(subject.vm.$apollo.mutate).toHaveBeenCalledWith({
mutation: dastOnDemandScanCreateMutation,
variables: {
input: {
branchName: defaultBranch,
dastScannerProfileId: passiveScannerProfile.id,
dastSiteProfileId: nonValidatedSiteProfile.id,
fullPath: projectPath,
},
},
});
});
});
describe.each` describe.each`
description | selectedScannerProfile | selectedSiteProfile | hasConflict description | selectedScannerProfile | selectedSiteProfile | hasConflict
${'a passive scan and a non-validated site'} | ${passiveScannerProfile} | ${nonValidatedSiteProfile} | ${false} ${'a passive scan and a non-validated site'} | ${passiveScannerProfile} | ${nonValidatedSiteProfile} | ${false}
......
...@@ -48,11 +48,6 @@ describe('EE - DastProfiles', () => { ...@@ -48,11 +48,6 @@ describe('EE - DastProfiles', () => {
{ {
propsData: defaultProps, propsData: defaultProps,
mocks: defaultMocks, mocks: defaultMocks,
provide: {
glFeatures: {
dastSavedScans: true,
},
},
}, },
options, options,
), ),
...@@ -240,33 +235,4 @@ describe('EE - DastProfiles', () => { ...@@ -240,33 +235,4 @@ describe('EE - DastProfiles', () => {
expect(mutate).toHaveBeenCalledTimes(1); expect(mutate).toHaveBeenCalledTimes(1);
}); });
}); });
describe('dastSavedScans feature flag disabled', () => {
beforeEach(() => {
createFullComponent({
provide: {
glFeatures: {
dastSavedScans: false,
},
},
});
});
it('does not show a "DAST Scan" item in the dropdown', () => {
expect(getSiteProfilesDropdownItem('DAST Scan')).toBe(null);
});
it('shows only 2 tabs', () => {
expect(withinComponent().getAllByRole('tab')).toHaveLength(2);
});
it('"Site Profile" tab should be selected by default', () => {
const tab = getTab({
tabName: 'Site Profiles',
selected: true,
});
expect(tab).not.toBe(null);
});
});
}); });
...@@ -36,14 +36,6 @@ RSpec.describe Mutations::Dast::Profiles::Create do ...@@ -36,14 +36,6 @@ RSpec.describe Mutations::Dast::Profiles::Create do
end end
context 'when the feature is licensed' do context 'when the feature is licensed' do
context 'when the feature is enabled' do
it 'raises an exception' do
stub_feature_flags(dast_saved_scans: false)
expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable)
end
end
context 'when the user can run a dast scan' do context 'when the user can run a dast scan' do
it 'returns the dast_profile' do it 'returns the dast_profile' do
expect(subject[:dast_profile]).to eq(dast_profile) expect(subject[:dast_profile]).to eq(dast_profile)
......
...@@ -23,20 +23,9 @@ RSpec.describe Mutations::Dast::Profiles::Run do ...@@ -23,20 +23,9 @@ RSpec.describe Mutations::Dast::Profiles::Run do
) )
end end
context 'when the feature flag dast_saved_scans is disabled' do
it 'raises an exception' do
stub_licensed_features(security_on_demand_scans: true)
stub_feature_flags(dast_saved_scans: false)
expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable)
end
end
context 'when on demand scan licensed feature is not available' do context 'when on demand scan licensed feature is not available' do
it 'raises an exception' do it 'raises an exception' do
stub_licensed_features(security_on_demand_scans: false) stub_licensed_features(security_on_demand_scans: false)
stub_feature_flags(dast_saved_scans: true)
expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable)
end end
end end
...@@ -44,7 +33,6 @@ RSpec.describe Mutations::Dast::Profiles::Run do ...@@ -44,7 +33,6 @@ RSpec.describe Mutations::Dast::Profiles::Run do
context 'when the feature is enabled' do context 'when the feature is enabled' do
before do before do
stub_licensed_features(security_on_demand_scans: true) stub_licensed_features(security_on_demand_scans: true)
stub_feature_flags(dast_saved_scans: true)
end end
context 'when the project does not exist' do context 'when the project does not exist' do
......
...@@ -102,14 +102,6 @@ RSpec.describe Mutations::Dast::Profiles::Update do ...@@ -102,14 +102,6 @@ RSpec.describe Mutations::Dast::Profiles::Update do
expect(subject[:errors]).to include('Profile failed to update') expect(subject[:errors]).to include('Profile failed to update')
end end
end end
context 'when the feature is not enabled' do
before do
stub_feature_flags(dast_saved_scans: false)
end
it_behaves_like 'an unrecoverable failure'
end
end end
end end
end end
......
...@@ -77,16 +77,6 @@ RSpec.describe 'Query.project(fullPath).dastProfiles' do ...@@ -77,16 +77,6 @@ RSpec.describe 'Query.project(fullPath).dastProfiles' do
expect(graphql_data_at(:project, :dast_profiles, :nodes, 0, 'branch')).to eq('name' => 'master', 'exists' => true) expect(graphql_data_at(:project, :dast_profiles, :nodes, 0, 'branch')).to eq('name' => 'master', 'exists' => true)
end end
context 'when the feature is disabled' do
it 'returns no nodes' do
stub_feature_flags(dast_saved_scans: false)
subject
expect(graphql_data_at(:project, :dast_profiles, :nodes)).to be_empty
end
end
end end
def pagination_query(arguments) def pagination_query(arguments)
......
...@@ -24,22 +24,9 @@ RSpec.describe Dast::Profiles::CreateService do ...@@ -24,22 +24,9 @@ RSpec.describe Dast::Profiles::CreateService do
subject { described_class.new(container: project, current_user: developer, params: params).execute } subject { described_class.new(container: project, current_user: developer, params: params).execute }
describe 'execute' do describe 'execute' do
context 'when on demand scan feature is disabled' do
it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: true)
stub_feature_flags(dast_saved_scans: false)
aggregate_failures do
expect(subject.status).to eq(:error)
expect(subject.message).to eq('Insufficient permissions')
end
end
end
context 'when on demand scan licensed feature is not available' do context 'when on demand scan licensed feature is not available' do
it 'communicates failure' do it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: false) stub_licensed_features(security_on_demand_scans: false)
stub_feature_flags(dast_saved_scans: true)
aggregate_failures do aggregate_failures do
expect(subject.status).to eq(:error) expect(subject.status).to eq(:error)
...@@ -51,7 +38,6 @@ RSpec.describe Dast::Profiles::CreateService do ...@@ -51,7 +38,6 @@ RSpec.describe Dast::Profiles::CreateService do
context 'when the feature is enabled' do context 'when the feature is enabled' do
before do before do
stub_licensed_features(security_on_demand_scans: true) stub_licensed_features(security_on_demand_scans: true)
stub_feature_flags(dast_saved_scans: true)
end end
it 'communicates success' do it 'communicates success' do
......
...@@ -18,22 +18,9 @@ RSpec.describe Dast::Profiles::DestroyService do ...@@ -18,22 +18,9 @@ RSpec.describe Dast::Profiles::DestroyService do
end end
describe '#execute' do describe '#execute' do
context 'when the feature flag dast_saved_scans is disabled' do
it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: true)
stub_feature_flags(dast_saved_scans: false)
expect(subject).to have_attributes(
status: :error,
message: 'You are not authorized to update this profile'
)
end
end
context 'when on demand scan licensed feature is not available' do context 'when on demand scan licensed feature is not available' do
it 'communicates failure' do it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: false) stub_licensed_features(security_on_demand_scans: false)
stub_feature_flags(dast_saved_scans: true)
expect(subject).to have_attributes( expect(subject).to have_attributes(
status: :error, status: :error,
...@@ -45,7 +32,6 @@ RSpec.describe Dast::Profiles::DestroyService do ...@@ -45,7 +32,6 @@ RSpec.describe Dast::Profiles::DestroyService do
context 'when the feature is enabled' do context 'when the feature is enabled' do
before do before do
stub_licensed_features(security_on_demand_scans: true) stub_licensed_features(security_on_demand_scans: true)
stub_feature_flags(dast_saved_scans: true)
end end
context 'when the user cannot destroy a DAST profile' do context 'when the user cannot destroy a DAST profile' do
......
...@@ -31,22 +31,9 @@ RSpec.describe Dast::Profiles::UpdateService do ...@@ -31,22 +31,9 @@ RSpec.describe Dast::Profiles::UpdateService do
end end
describe 'execute', :clean_gitlab_redis_shared_state do describe 'execute', :clean_gitlab_redis_shared_state do
context 'when on demand scan feature is disabled' do
it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: true)
stub_feature_flags(dast_saved_scans: false)
aggregate_failures do
expect(subject.status).to eq(:error)
expect(subject.message).to eq('You are not authorized to update this profile')
end
end
end
context 'when on demand scan licensed feature is not available' do context 'when on demand scan licensed feature is not available' do
it 'communicates failure' do it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: false) stub_licensed_features(security_on_demand_scans: false)
stub_feature_flags(dast_saved_scans: true)
aggregate_failures do aggregate_failures do
expect(subject.status).to eq(:error) expect(subject.status).to eq(:error)
...@@ -58,7 +45,6 @@ RSpec.describe Dast::Profiles::UpdateService do ...@@ -58,7 +45,6 @@ RSpec.describe Dast::Profiles::UpdateService do
context 'when the feature is enabled' do context 'when the feature is enabled' do
before do before do
stub_licensed_features(security_on_demand_scans: true) stub_licensed_features(security_on_demand_scans: true)
stub_feature_flags(dast_saved_scans: true)
end end
context 'when the user cannot run a DAST scan' do context 'when the user cannot run a DAST scan' do
......
...@@ -12,18 +12,6 @@ RSpec.describe DastSiteValidations::CreateService do ...@@ -12,18 +12,6 @@ RSpec.describe DastSiteValidations::CreateService do
subject { described_class.new(container: dast_site.project, params: params).execute } subject { described_class.new(container: dast_site.project, params: params).execute }
describe 'execute', :clean_gitlab_redis_shared_state do describe 'execute', :clean_gitlab_redis_shared_state do
context 'when on demand scan feature is disabled' do
it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: false)
stub_feature_flags(dast_saved_scans: false)
aggregate_failures do
expect(subject.status).to eq(:error)
expect(subject.message).to eq('Insufficient permissions')
end
end
end
context 'when on demand scan licensed feature is not available' do context 'when on demand scan licensed feature is not available' do
it 'communicates failure' do it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: false) stub_licensed_features(security_on_demand_scans: false)
......
...@@ -16,18 +16,6 @@ RSpec.describe DastSiteValidations::RevokeService do ...@@ -16,18 +16,6 @@ RSpec.describe DastSiteValidations::RevokeService do
subject { described_class.new(container: project, params: params).execute } subject { described_class.new(container: project, params: params).execute }
describe 'execute', :clean_gitlab_redis_shared_state do describe 'execute', :clean_gitlab_redis_shared_state do
context 'when on demand scan feature is disabled' do
it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: false)
stub_feature_flags(dast_saved_scans: false)
aggregate_failures do
expect(subject.status).to eq(:error)
expect(subject.message).to eq('Insufficient permissions')
end
end
end
context 'when on demand scan licensed feature is not available' do context 'when on demand scan licensed feature is not available' do
it 'communicates failure' do it 'communicates failure' do
stub_licensed_features(security_on_demand_scans: false) stub_licensed_features(security_on_demand_scans: false)
......
...@@ -21284,9 +21284,6 @@ msgstr "" ...@@ -21284,9 +21284,6 @@ msgstr ""
msgid "OnDemandScans|Manage DAST scans" msgid "OnDemandScans|Manage DAST scans"
msgstr "" msgstr ""
msgid "OnDemandScans|Manage profiles"
msgstr ""
msgid "OnDemandScans|Manage scanner profiles" msgid "OnDemandScans|Manage scanner profiles"
msgstr "" msgstr ""
...@@ -21311,9 +21308,6 @@ msgstr "" ...@@ -21311,9 +21308,6 @@ msgstr ""
msgid "OnDemandScans|On-demand scans run outside the DevOps cycle and find vulnerabilities in your projects. %{learnMoreLinkStart}Learn more%{learnMoreLinkEnd}" msgid "OnDemandScans|On-demand scans run outside the DevOps cycle and find vulnerabilities in your projects. %{learnMoreLinkStart}Learn more%{learnMoreLinkEnd}"
msgstr "" msgstr ""
msgid "OnDemandScans|Run scan"
msgstr ""
msgid "OnDemandScans|Save and run scan" msgid "OnDemandScans|Save and run scan"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment