diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 9eb43d4f73d017153fa62973779f7fb6a8464ea9..c622db0ccf244edefcda83d8fa7acafd4bf1848e 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -4667,7 +4667,7 @@ An edge in a connection. | `containerRepositories` | [`ContainerRepositoryConnection`](#containerrepositoryconnection) | Container repositories of the project. | | `containerRepositoriesCount` | [`Int!`](#int) | Number of container repositories in the project. | | `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. | | `dastSiteProfile` | [`DastSiteProfile`](#dastsiteprofile) | DAST Site Profile associated with the project. | | `dastSiteProfiles` | [`DastSiteProfileConnection`](#dastsiteprofileconnection) | DAST Site Profiles associated with the project. | diff --git a/ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue b/ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue index 8b8513a41fd9fd262d5b7013e135b9e92eb9f148..d16941aa5ba93b47ba6e6256570e71f7732554da 100644 --- a/ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue +++ b/ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue @@ -28,7 +28,6 @@ import { REF_TYPE_BRANCHES } from '~/ref/constants'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import validation from '~/vue_shared/directives/validation'; 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 dastProfileUpdateMutation from '../graphql/dast_profile_update.mutation.graphql'; import { @@ -140,24 +139,19 @@ export default { }, }, data() { - const savedScansFields = this.glFeatures.dastSavedScans - ? { - form: { - showValidation: false, - state: false, - fields: { - name: initFormField({ value: this.dastScan?.name ?? '' }), - description: initFormField({ - value: this.dastScan?.description ?? '', - required: false, - skipValidation: true, - }), - }, - }, - } - : {}; return { - ...savedScansFields, + form: { + showValidation: false, + state: false, + fields: { + name: initFormField({ value: this.dastScan?.name ?? '' }), + description: initFormField({ + value: this.dastScan?.description ?? '', + required: false, + skipValidation: true, + }), + }, + }, scannerProfiles: [], siteProfiles: [], selectedBranch: this.dastScan?.branch?.name ?? this.defaultBranch, @@ -179,11 +173,6 @@ export default { ? s__('OnDemandScans|Edit 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() { return this.selectedScannerProfileId ? this.scannerProfiles.find(({ id }) => id === this.selectedScannerProfileId) @@ -256,32 +245,23 @@ export default { }, methods: { onSubmit({ runAfter = true, button = this.$options.saveAndRunScanBtnId } = {}) { - if (this.glFeatures.dastSavedScans) { - this.form.showValidation = true; - if (!this.form.state) { - return; - } + this.form.showValidation = true; + if (!this.form.state) { + return; } this.loading = button; this.hideErrors(); - let mutation = dastOnDemandScanCreateMutation; - let responseType = 'dastOnDemandScanCreate'; - let input = { + const mutation = this.isEdit ? dastProfileUpdateMutation : dastProfileCreateMutation; + const responseType = this.isEdit ? 'dastProfileUpdate' : 'dastProfileCreate'; + const input = { fullPath: this.projectPath, dastScannerProfileId: this.selectedScannerProfile.id, dastSiteProfileId: this.selectedSiteProfile.id, + ...(this.isEdit ? { id: this.dastScan.id } : {}), + ...serializeFormObject(this.form.fields), + [this.isEdit ? 'runAfterUpdate' : 'runAfterCreate']: runAfter, }; - if (this.glFeatures.dastSavedScans) { - mutation = this.isEdit ? dastProfileUpdateMutation : dastProfileCreateMutation; - responseType = this.isEdit ? 'dastProfileUpdate' : 'dastProfileCreate'; - input = { - ...input, - ...(this.isEdit ? { id: this.dastScan.id } : {}), - ...serializeFormObject(this.form.fields), - [this.isEdit ? 'runAfterUpdate' : 'runAfterCreate']: runAfter, - }; - } if (this.glFeatures.dastBranchSelection) { input.branchName = this.selectedBranch; } @@ -299,7 +279,7 @@ export default { if (errors?.length) { this.showErrors(ERROR_RUN_SCAN, errors); this.loading = false; - } else if (this.glFeatures.dastSavedScans && !runAfter) { + } else if (!runAfter) { redirectTo(response.dastProfile.editPath); this.clearStorage = true; } else { @@ -345,7 +325,7 @@ export default { <template> <gl-form novalidate @submit.prevent="onSubmit()"> <local-storage-sync - v-if="glFeatures.dastSavedScans && !isEdit" + v-if="!isEdit" as-json :storage-key="$options.ON_DEMAND_SCANS_STORAGE_KEY" :clear="clearStorage" @@ -356,7 +336,7 @@ export default { <div class="gl-mt-6 gl-display-flex"> <h2 class="gl-flex-grow-1 gl-my-0">{{ title }}</h2> <gl-button :href="profilesLibraryPath" data-testid="manage-profiles-link"> - {{ manageProfilesLabel }} + {{ s__('OnDemandScans|Manage DAST scans') }} </gl-button> </div> <p> @@ -391,7 +371,7 @@ export default { </gl-alert> <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="24" width="460" height="32" rx="4" /> <rect x="0" y="71" width="100" height="15" rx="4" /> @@ -412,33 +392,31 @@ export default { </gl-card> </template> <template v-else-if="!failedToLoadProfiles"> - <template v-if="glFeatures.dastSavedScans"> - <gl-form-group - :label="s__('OnDemandScans|Scan name')" - :invalid-feedback="form.fields.name.feedback" - > - <gl-form-input - v-model="form.fields.name.value" - v-validation:[form.showValidation] - class="mw-460" - data-testid="dast-scan-name-input" - type="text" - :placeholder="s__('OnDemandScans|My daily scan')" - :state="form.fields.name.state" - name="name" - required - /> - </gl-form-group> - <gl-form-group :label="s__('OnDemandScans|Description (optional)')"> - <gl-form-textarea - v-model="form.fields.description.value" - class="mw-460" - data-testid="dast-scan-description-input" - :placeholder="s__(`OnDemandScans|For example: Tests the login page for SQL injections`)" - :state="form.fields.description.state" - /> - </gl-form-group> - </template> + <gl-form-group + :label="s__('OnDemandScans|Scan name')" + :invalid-feedback="form.fields.name.feedback" + > + <gl-form-input + v-model="form.fields.name.value" + v-validation:[form.showValidation] + class="mw-460" + data-testid="dast-scan-name-input" + type="text" + :placeholder="s__('OnDemandScans|My daily scan')" + :state="form.fields.name.state" + name="name" + required + /> + </gl-form-group> + <gl-form-group :label="s__('OnDemandScans|Description (optional)')"> + <gl-form-textarea + v-model="form.fields.description.value" + class="mw-460" + data-testid="dast-scan-description-input" + :placeholder="s__(`OnDemandScans|For example: Tests the login page for SQL injections`)" + :state="form.fields.description.state" + /> + </gl-form-group> <gl-form-group v-if="glFeatures.dastBranchSelection" :label="__('Branch')"> <ref-selector @@ -574,14 +552,9 @@ export default { :disabled="isSubmitButtonDisabled" :loading="loading === $options.saveAndRunScanBtnId" > - {{ - glFeatures.dastSavedScans - ? s__('OnDemandScans|Save and run scan') - : s__('OnDemandScans|Run scan') - }} + {{ s__('OnDemandScans|Save and run scan') }} </gl-button> <gl-button - v-if="glFeatures.dastSavedScans" variant="success" category="secondary" data-testid="on-demand-scan-save-button" diff --git a/ee/app/assets/javascripts/on_demand_scans/graphql/dast_on_demand_scan_create.mutation.graphql b/ee/app/assets/javascripts/on_demand_scans/graphql/dast_on_demand_scan_create.mutation.graphql deleted file mode 100644 index cb163a34ab23d7517c5aa5bff94697a07bd6bf6d..0000000000000000000000000000000000000000 --- a/ee/app/assets/javascripts/on_demand_scans/graphql/dast_on_demand_scan_create.mutation.graphql +++ /dev/null @@ -1,6 +0,0 @@ -mutation dastOnDemandScanCreate($input: DastOnDemandScanCreateInput!) { - dastOnDemandScanCreate(input: $input) { - pipelineUrl - errors - } -} diff --git a/ee/app/assets/javascripts/security_configuration/dast_profiles/components/dast_profiles.vue b/ee/app/assets/javascripts/security_configuration/dast_profiles/components/dast_profiles.vue index 20cb43565ade8bf4553e4f239120235000cd1048..07c022e2016a5ebd9bd722ec84ae5f97a49baaf5 100644 --- a/ee/app/assets/javascripts/security_configuration/dast_profiles/components/dast_profiles.vue +++ b/ee/app/assets/javascripts/security_configuration/dast_profiles/components/dast_profiles.vue @@ -39,7 +39,6 @@ export default { return getProfileSettings({ createNewProfilePaths, - isDastSavedScansEnabled: this.glFeatures.dastSavedScans, }); }, tabIndex: { diff --git a/ee/app/assets/javascripts/security_configuration/dast_profiles/settings/profiles.js b/ee/app/assets/javascripts/security_configuration/dast_profiles/settings/profiles.js index eca0bfc85bb674c5f10b2c140a846b4ca6a72ce3..4c002d4d0310fdb75035d6e0b7879266cbbfa4df 100644 --- a/ee/app/assets/javascripts/security_configuration/dast_profiles/settings/profiles.js +++ b/ee/app/assets/javascripts/security_configuration/dast_profiles/settings/profiles.js @@ -10,54 +10,50 @@ 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 { s__ } from '~/locale'; -export const getProfileSettings = ({ createNewProfilePaths, isDastSavedScansEnabled }) => ({ - ...(isDastSavedScansEnabled - ? { - dastProfiles: { - profileType: 'dastProfiles', - createNewProfilePath: createNewProfilePaths.savedScan, - graphQL: { - query: dastProfilesQuery, - deletion: { - mutation: dastProfileDelete, - optimisticResponse: dastProfilesDeleteResponse({ - mutationName: 'dastProfileDelete', - payloadTypeName: 'DastProfileDeletePayload', - }), - }, - }, - component: DastSavedScansList, - tableFields: [ - { - label: s__('DastProfiles|Scan'), - key: 'name', - }, - { - label: s__('DastProfiles|Target'), - key: 'dastSiteProfile.targetUrl', - }, - { - label: s__('DastProfiles|Scan mode'), - key: 'dastScannerProfile.scanType', - }, - ], - i18n: { - createNewLinkText: s__('DastProfiles|DAST Scan'), - name: s__('DastProfiles|Saved Scans'), - errorMessages: { - fetchNetworkError: s__( - 'DastProfiles|Could not fetch saved scans. Please refresh the page, or try again later.', - ), - deletionNetworkError: s__( - 'DastProfiles|Could not delete saved scan. Please refresh the page, or try again later.', - ), - deletionBackendError: s__('DastProfiles|Could not delete saved scans:'), - }, - noProfilesMessage: s__('DastProfiles|No scans saved yet'), - }, - }, - } - : {}), +export const getProfileSettings = ({ createNewProfilePaths }) => ({ + dastProfiles: { + profileType: 'dastProfiles', + createNewProfilePath: createNewProfilePaths.savedScan, + graphQL: { + query: dastProfilesQuery, + deletion: { + mutation: dastProfileDelete, + optimisticResponse: dastProfilesDeleteResponse({ + mutationName: 'dastProfileDelete', + payloadTypeName: 'DastProfileDeletePayload', + }), + }, + }, + component: DastSavedScansList, + tableFields: [ + { + label: s__('DastProfiles|Scan'), + key: 'name', + }, + { + label: s__('DastProfiles|Target'), + key: 'dastSiteProfile.targetUrl', + }, + { + label: s__('DastProfiles|Scan mode'), + key: 'dastScannerProfile.scanType', + }, + ], + i18n: { + createNewLinkText: s__('DastProfiles|DAST Scan'), + name: s__('DastProfiles|Saved Scans'), + errorMessages: { + fetchNetworkError: s__( + 'DastProfiles|Could not fetch saved scans. Please refresh the page, or try again later.', + ), + deletionNetworkError: s__( + 'DastProfiles|Could not delete saved scan. Please refresh the page, or try again later.', + ), + deletionBackendError: s__('DastProfiles|Could not delete saved scans:'), + }, + noProfilesMessage: s__('DastProfiles|No scans saved yet'), + }, + }, siteProfiles: { profileType: 'siteProfiles', createNewProfilePath: createNewProfilePaths.siteProfile, diff --git a/ee/app/controllers/projects/on_demand_scans_controller.rb b/ee/app/controllers/projects/on_demand_scans_controller.rb index 9c2e578b3858c32f83acd7b9696cc0428f140fff..f8ec11b91791a76f90e99d857c98c9bcced6f4d0 100644 --- a/ee/app/controllers/projects/on_demand_scans_controller.rb +++ b/ee/app/controllers/projects/on_demand_scans_controller.rb @@ -6,7 +6,6 @@ module Projects before_action do 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) end @@ -19,12 +18,9 @@ module Projects end def new - not_found unless Feature.enabled?(:dast_saved_scans, @project, default_enabled: :yaml) end 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 = { diff --git a/ee/app/controllers/projects/security/dast_profiles_controller.rb b/ee/app/controllers/projects/security/dast_profiles_controller.rb index b2aba6e08307ae30781724f4b9b60b6f1409c09a..74f6b085f9e0e25936bb4e43e9032042d3eac6c2 100644 --- a/ee/app/controllers/projects/security/dast_profiles_controller.rb +++ b/ee/app/controllers/projects/security/dast_profiles_controller.rb @@ -7,7 +7,6 @@ module Projects before_action do 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_branch_selection, @project, default_enabled: :yaml) end diff --git a/ee/app/graphql/ee/types/project_type.rb b/ee/app/graphql/ee/types/project_type.rb index 6849291702ec80962b36a99020fa8fcbfab04723..2cc3c89d4db5b97ff8d73ae00ccc098bda39c2ee 100644 --- a/ee/app/graphql/ee/types/project_type.rb +++ b/ee/app/graphql/ee/types/project_type.rb @@ -59,8 +59,7 @@ module EE field :dast_profiles, ::Types::Dast::ProfileType.connection_type, null: true, - description: 'DAST Profiles associated with the project. Always returns no nodes ' \ - 'if `dast_saved_scans` is disabled.' + description: 'DAST Profiles associated with the project.' field :dast_site_profile, ::Types::DastSiteProfileType, @@ -152,8 +151,6 @@ module EE end 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 end diff --git a/ee/app/graphql/mutations/dast/profiles/create.rb b/ee/app/graphql/mutations/dast/profiles/create.rb index 4c416b2f98d6adf854deab0ee455cb19543a0a87..773462a5d4812409b6387a8321e988f685e3e3a3 100644 --- a/ee/app/graphql/mutations/dast/profiles/create.rb +++ b/ee/app/graphql/mutations/dast/profiles/create.rb @@ -83,8 +83,7 @@ module Mutations private def allowed?(project) - project.feature_available?(:security_on_demand_scans) && - Feature.enabled?(:dast_saved_scans, project, default_enabled: :yaml) + project.feature_available?(:security_on_demand_scans) end def feature_flagged_branch_name(project, branch_name) diff --git a/ee/app/graphql/mutations/dast/profiles/delete.rb b/ee/app/graphql/mutations/dast/profiles/delete.rb index af2e9cb4e115a9e744d54275e103c5a44dc02731..1d6e31081c385fda2edcef3b4fd931c4ddd1ada3 100644 --- a/ee/app/graphql/mutations/dast/profiles/delete.rb +++ b/ee/app/graphql/mutations/dast/profiles/delete.rb @@ -16,7 +16,6 @@ module Mutations def resolve(id:) dast_profile = authorized_find!(id) - raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless enabled?(dast_profile.project) response = ::Dast::Profiles::DestroyService.new( container: dast_profile.project, @@ -29,10 +28,6 @@ module Mutations private - def enabled?(project) - Feature.enabled?(:dast_saved_scans, project, default_enabled: :yaml) - end - def find_object(id) # TODO: remove this line when the compatibility layer is removed # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 diff --git a/ee/app/graphql/mutations/dast/profiles/run.rb b/ee/app/graphql/mutations/dast/profiles/run.rb index 347b3f462dcaeabcfd8751cbc31280add7cb0a7f..d82bfe3811a247f3dc3ab1939d97254f2e1b708f 100644 --- a/ee/app/graphql/mutations/dast/profiles/run.rb +++ b/ee/app/graphql/mutations/dast/profiles/run.rb @@ -45,8 +45,7 @@ module Mutations private def allowed?(project) - project.feature_available?(:security_on_demand_scans) && - Feature.enabled?(:dast_saved_scans, project, default_enabled: :yaml) + project.feature_available?(:security_on_demand_scans) end def find_dast_profile(project, id) diff --git a/ee/app/graphql/mutations/dast/profiles/update.rb b/ee/app/graphql/mutations/dast/profiles/update.rb index cba4e34d1c320225922f4ff2322a73e329deb289..bca907ffbf89724ba52d523ee20865fbeb5e2fc1 100644 --- a/ee/app/graphql/mutations/dast/profiles/update.rb +++ b/ee/app/graphql/mutations/dast/profiles/update.rb @@ -88,8 +88,7 @@ module Mutations private def allowed?(project) - project.feature_available?(:security_on_demand_scans) && - Feature.enabled?(:dast_saved_scans, project, default_enabled: :yaml) + project.feature_available?(:security_on_demand_scans) end def as_model_id(klass, value) diff --git a/ee/app/services/dast/profiles/create_service.rb b/ee/app/services/dast/profiles/create_service.rb index 05061adbaa89006cc96ad4a3dd65bd35f5c87120..3b03e6f5bf616ed998f19a18d7bf4ebbcfed728e 100644 --- a/ee/app/services/dast/profiles/create_service.rb +++ b/ee/app/services/dast/profiles/create_service.rb @@ -39,8 +39,7 @@ module Dast private def allowed? - container.feature_available?(:security_on_demand_scans) && - Feature.enabled?(:dast_saved_scans, container, default_enabled: :yaml) + container.feature_available?(:security_on_demand_scans) end def dast_site_profile diff --git a/ee/app/services/dast/profiles/destroy_service.rb b/ee/app/services/dast/profiles/destroy_service.rb index bbfb7a065584939e584c52dda207a54bca5e18d4..f816dae948d7800145bed8ee1a093530e39259af 100644 --- a/ee/app/services/dast/profiles/destroy_service.rb +++ b/ee/app/services/dast/profiles/destroy_service.rb @@ -14,8 +14,7 @@ module Dast private 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 def unauthorized diff --git a/ee/app/services/dast/profiles/update_service.rb b/ee/app/services/dast/profiles/update_service.rb index dac4488ebf2ffa9acb1e0d0b1075e379125a3023..2d08f6aa155ec4abb83fc2347b7bd89fb37345f3 100644 --- a/ee/app/services/dast/profiles/update_service.rb +++ b/ee/app/services/dast/profiles/update_service.rb @@ -23,7 +23,6 @@ module Dast def allowed? 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) end diff --git a/ee/app/views/layouts/nav/sidebar/_project_security_link.html.haml b/ee/app/views/layouts/nav/sidebar/_project_security_link.html.haml index f7d0cfc0d64021b6a682ea76a8f931ea3d140041..3cb7312dfad0c675db250267d2277086035e64e4 100644 --- a/ee/app/views/layouts/nav/sidebar/_project_security_link.html.haml +++ b/ee/app/views/layouts/nav/sidebar/_project_security_link.html.haml @@ -1,4 +1,4 @@ -- 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]) = nav_link(path: sidebar_security_paths) do diff --git a/ee/app/views/projects/security/dast_scanner_profiles/edit.html.haml b/ee/app/views/projects/security/dast_scanner_profiles/edit.html.haml index 868ea4f2934017125dcea4ecd0a4a2728aeed9bb..8e0e8e7bffc699f1f6f0bc35f6ee245dd785c0b2 100644 --- a/ee/app/views/projects/security/dast_scanner_profiles/edit.html.haml +++ b/ee/app/views/projects/security/dast_scanner_profiles/edit.html.haml @@ -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, 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, -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) } } diff --git a/ee/app/views/projects/security/dast_scanner_profiles/new.html.haml b/ee/app/views/projects/security/dast_scanner_profiles/new.html.haml index 7afe690cba81d5ac516d3baf1579edc05b30e8f7..18346f1d3310dc720d0bb6b7467c81c142b66841 100644 --- a/ee/app/views/projects/security/dast_scanner_profiles/new.html.haml +++ b/ee/app/views/projects/security/dast_scanner_profiles/new.html.haml @@ -5,4 +5,4 @@ .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'), -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) } } diff --git a/ee/app/views/projects/security/dast_site_profiles/edit.html.haml b/ee/app/views/projects/security/dast_site_profiles/edit.html.haml index c25ac93b462efb6134f29abbae4490f1869a1260..e2551c56be6baafba524a0211dfa73acef0630db 100644 --- a/ee/app/views/projects/security/dast_site_profiles/edit.html.haml +++ b/ee/app/views/projects/security/dast_site_profiles/edit.html.haml @@ -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, 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, -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) } } diff --git a/ee/app/views/projects/security/dast_site_profiles/new.html.haml b/ee/app/views/projects/security/dast_site_profiles/new.html.haml index a5c12a2afc9639e714a323ea34fe3f01bb94acc8..3ad99c54990e5e9c26e0331300bf702d0713bd0f 100644 --- a/ee/app/views/projects/security/dast_site_profiles/new.html.haml +++ b/ee/app/views/projects/security/dast_site_profiles/new.html.haml @@ -5,4 +5,4 @@ .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'), -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) } } diff --git a/ee/changelogs/unreleased/295252-remove-dast-saved-scans-ff.yml b/ee/changelogs/unreleased/295252-remove-dast-saved-scans-ff.yml new file mode 100644 index 0000000000000000000000000000000000000000..ad74719370f4898c1ae9262a872d8ac391ebda86 --- /dev/null +++ b/ee/changelogs/unreleased/295252-remove-dast-saved-scans-ff.yml @@ -0,0 +1,5 @@ +--- +title: Remove the dast_saved_scans feature flag +merge_request: 56540 +author: +type: removed diff --git a/ee/config/feature_flags/development/dast_saved_scans.yml b/ee/config/feature_flags/development/dast_saved_scans.yml deleted file mode 100644 index 309adae26238880b269869ed4c82b9380defaba8..0000000000000000000000000000000000000000 --- a/ee/config/feature_flags/development/dast_saved_scans.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -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 diff --git a/ee/spec/frontend/on_demand_scans/components/on_demand_scans_form_spec.js b/ee/spec/frontend/on_demand_scans/components/on_demand_scans_form_spec.js index a898565bee8a107bca116ca28e8d1679c3a63d34..ae232612c2e4568447644b7dd9977c8662220d74 100644 --- a/ee/spec/frontend/on_demand_scans/components/on_demand_scans_form_spec.js +++ b/ee/spec/frontend/on_demand_scans/components/on_demand_scans_form_spec.js @@ -5,7 +5,6 @@ import VueApollo from 'vue-apollo'; 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 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 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'; @@ -152,7 +151,6 @@ describe('OnDemandScansForm', () => { newScannerProfilePath, newSiteProfilePath, glFeatures: { - dastSavedScans: true, dastBranchSelection: true, }, }, @@ -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` description | selectedScannerProfile | selectedSiteProfile | hasConflict ${'a passive scan and a non-validated site'} | ${passiveScannerProfile} | ${nonValidatedSiteProfile} | ${false} diff --git a/ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_spec.js b/ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_spec.js index 2bef5b564c58af6c2b3f5447d59234c4494b2b3d..72c55458115c19e3f7d62e4f507d739beb8495af 100644 --- a/ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_spec.js +++ b/ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_spec.js @@ -48,11 +48,6 @@ describe('EE - DastProfiles', () => { { propsData: defaultProps, mocks: defaultMocks, - provide: { - glFeatures: { - dastSavedScans: true, - }, - }, }, options, ), @@ -240,33 +235,4 @@ describe('EE - DastProfiles', () => { 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); - }); - }); }); diff --git a/ee/spec/graphql/mutations/dast/profiles/create_spec.rb b/ee/spec/graphql/mutations/dast/profiles/create_spec.rb index f6062f8464a60a716580ac7b9c737530f4f53a5d..532a912d1272ce5f46ddeef2aa1158529421d5a4 100644 --- a/ee/spec/graphql/mutations/dast/profiles/create_spec.rb +++ b/ee/spec/graphql/mutations/dast/profiles/create_spec.rb @@ -36,14 +36,6 @@ RSpec.describe Mutations::Dast::Profiles::Create do end 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 it 'returns the dast_profile' do expect(subject[:dast_profile]).to eq(dast_profile) diff --git a/ee/spec/graphql/mutations/dast/profiles/run_spec.rb b/ee/spec/graphql/mutations/dast/profiles/run_spec.rb index 64244736d8530980bb0db2661b8ed4f8f8e5ca98..420adfdb40e7a0eef8b8e6eb747a6a5863f7c9c8 100644 --- a/ee/spec/graphql/mutations/dast/profiles/run_spec.rb +++ b/ee/spec/graphql/mutations/dast/profiles/run_spec.rb @@ -23,20 +23,9 @@ RSpec.describe Mutations::Dast::Profiles::Run do ) 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 it 'raises an exception' do stub_licensed_features(security_on_demand_scans: false) - stub_feature_flags(dast_saved_scans: true) - expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) end end @@ -44,7 +33,6 @@ RSpec.describe Mutations::Dast::Profiles::Run do context 'when the feature is enabled' do before do stub_licensed_features(security_on_demand_scans: true) - stub_feature_flags(dast_saved_scans: true) end context 'when the project does not exist' do diff --git a/ee/spec/graphql/mutations/dast/profiles/update_spec.rb b/ee/spec/graphql/mutations/dast/profiles/update_spec.rb index 084365803275def6300ddfc2676e8cf4a341c6a3..060871a34308de635a6bb54434f925844d7e9e65 100644 --- a/ee/spec/graphql/mutations/dast/profiles/update_spec.rb +++ b/ee/spec/graphql/mutations/dast/profiles/update_spec.rb @@ -102,14 +102,6 @@ RSpec.describe Mutations::Dast::Profiles::Update do expect(subject[:errors]).to include('Profile failed to update') 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 diff --git a/ee/spec/requests/api/graphql/project/dast_profiles_spec.rb b/ee/spec/requests/api/graphql/project/dast_profiles_spec.rb index 98a6ff9eac09bcefe64acb5eacbc54ec36b1a462..5421fddcba7eec3650175b00930f4aca8d911681 100644 --- a/ee/spec/requests/api/graphql/project/dast_profiles_spec.rb +++ b/ee/spec/requests/api/graphql/project/dast_profiles_spec.rb @@ -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) 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 def pagination_query(arguments) diff --git a/ee/spec/services/dast/profiles/create_service_spec.rb b/ee/spec/services/dast/profiles/create_service_spec.rb index e6fdd10c2b9185dbcb2239343c78a7dadba5eab8..1c07b738f38e8963588b13eced2843bcb1252fc7 100644 --- a/ee/spec/services/dast/profiles/create_service_spec.rb +++ b/ee/spec/services/dast/profiles/create_service_spec.rb @@ -24,22 +24,9 @@ RSpec.describe Dast::Profiles::CreateService do subject { described_class.new(container: project, current_user: developer, params: params).execute } 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 it 'communicates failure' do stub_licensed_features(security_on_demand_scans: false) - stub_feature_flags(dast_saved_scans: true) aggregate_failures do expect(subject.status).to eq(:error) @@ -51,7 +38,6 @@ RSpec.describe Dast::Profiles::CreateService do context 'when the feature is enabled' do before do stub_licensed_features(security_on_demand_scans: true) - stub_feature_flags(dast_saved_scans: true) end it 'communicates success' do diff --git a/ee/spec/services/dast/profiles/destroy_service_spec.rb b/ee/spec/services/dast/profiles/destroy_service_spec.rb index fc2ab813afb4139ec016099edc595ae9a2ab4f09..b5b7f68975747ddaa4ab7b27a0ab15b4f37b104a 100644 --- a/ee/spec/services/dast/profiles/destroy_service_spec.rb +++ b/ee/spec/services/dast/profiles/destroy_service_spec.rb @@ -18,22 +18,9 @@ RSpec.describe Dast::Profiles::DestroyService do end 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 it 'communicates failure' do stub_licensed_features(security_on_demand_scans: false) - stub_feature_flags(dast_saved_scans: true) expect(subject).to have_attributes( status: :error, @@ -45,7 +32,6 @@ RSpec.describe Dast::Profiles::DestroyService do context 'when the feature is enabled' do before do stub_licensed_features(security_on_demand_scans: true) - stub_feature_flags(dast_saved_scans: true) end context 'when the user cannot destroy a DAST profile' do diff --git a/ee/spec/services/dast/profiles/update_service_spec.rb b/ee/spec/services/dast/profiles/update_service_spec.rb index e4c39fdb566a20180756b3375ff16b98f02462fc..2e2d6af7cd11dfe65a77d84dc00cabc5e777f62b 100644 --- a/ee/spec/services/dast/profiles/update_service_spec.rb +++ b/ee/spec/services/dast/profiles/update_service_spec.rb @@ -31,22 +31,9 @@ RSpec.describe Dast::Profiles::UpdateService do end 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 it 'communicates failure' do stub_licensed_features(security_on_demand_scans: false) - stub_feature_flags(dast_saved_scans: true) aggregate_failures do expect(subject.status).to eq(:error) @@ -58,7 +45,6 @@ RSpec.describe Dast::Profiles::UpdateService do context 'when the feature is enabled' do before do stub_licensed_features(security_on_demand_scans: true) - stub_feature_flags(dast_saved_scans: true) end context 'when the user cannot run a DAST scan' do diff --git a/ee/spec/services/dast_site_validations/create_service_spec.rb b/ee/spec/services/dast_site_validations/create_service_spec.rb index f6f670832d56e0f07fb467f078d829e457b0a643..ae86795d399ac4744c9e27cf13401136151cff50 100644 --- a/ee/spec/services/dast_site_validations/create_service_spec.rb +++ b/ee/spec/services/dast_site_validations/create_service_spec.rb @@ -12,18 +12,6 @@ RSpec.describe DastSiteValidations::CreateService do subject { described_class.new(container: dast_site.project, params: params).execute } 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 it 'communicates failure' do stub_licensed_features(security_on_demand_scans: false) diff --git a/ee/spec/services/dast_site_validations/revoke_service_spec.rb b/ee/spec/services/dast_site_validations/revoke_service_spec.rb index f6cb477164e466344e910226de6c126b14b5b0de..3d9628eb3afb5719c37bdeca486a78d2db87c853 100644 --- a/ee/spec/services/dast_site_validations/revoke_service_spec.rb +++ b/ee/spec/services/dast_site_validations/revoke_service_spec.rb @@ -16,18 +16,6 @@ RSpec.describe DastSiteValidations::RevokeService do subject { described_class.new(container: project, params: params).execute } 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 it 'communicates failure' do stub_licensed_features(security_on_demand_scans: false) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 8d5042e1036cd8673dfc680bbc35450fff434fe7..a9154f312222e638309a5177a275022b4685b8e6 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -21278,9 +21278,6 @@ msgstr "" msgid "OnDemandScans|Manage DAST scans" msgstr "" -msgid "OnDemandScans|Manage profiles" -msgstr "" - msgid "OnDemandScans|Manage scanner profiles" msgstr "" @@ -21305,9 +21302,6 @@ msgstr "" msgid "OnDemandScans|On-demand scans run outside the DevOps cycle and find vulnerabilities in your projects. %{learnMoreLinkStart}Learn more%{learnMoreLinkEnd}" msgstr "" -msgid "OnDemandScans|Run scan" -msgstr "" - msgid "OnDemandScans|Save and run scan" msgstr ""