From 0d05f8de936646d95d4d5fa4c60a24014701e57e Mon Sep 17 00:00:00 2001 From: Paul Gascou-Vaillancourt <paul.gascvail@gmail.com> Date: Thu, 6 Jan 2022 15:00:11 +0100 Subject: [PATCH] Remove the dast_view_scans feature flag This removes the dast_view_scans feature flag and makes the on-demand scans index page publicly available. Changelog: other EE: true --- .../resolvers/concerns/resolves_pipelines.rb | 4 +-- .../development/dast_view_scans.yml | 8 ----- doc/api/graphql/reference/index.md | 12 ++++---- .../projects/on_demand_scans_controller.rb | 1 - ee/app/graphql/ee/types/ci/pipeline_type.rb | 5 ++-- .../app_sec/dast/profile_resolver.rb | 3 +- .../menus/security_compliance_menu.rb | 6 +--- .../api/graphql/project/dast_profiles_spec.rb | 30 ++++--------------- .../project/pipelines/dast_profile_spec.rb | 10 ------- .../on_demand_scans_controller_spec.rb | 14 --------- .../nav/sidebar/_project.html.haml_spec.rb | 16 ---------- .../concerns/resolves_pipelines_spec.rb | 20 +++---------- 12 files changed, 20 insertions(+), 109 deletions(-) delete mode 100644 config/feature_flags/development/dast_view_scans.yml diff --git a/app/graphql/resolvers/concerns/resolves_pipelines.rb b/app/graphql/resolvers/concerns/resolves_pipelines.rb index 1c01e5e025081..42c4c22a9388a 100644 --- a/app/graphql/resolvers/concerns/resolves_pipelines.rb +++ b/app/graphql/resolvers/concerns/resolves_pipelines.rb @@ -24,7 +24,7 @@ module ResolvesPipelines argument :source, GraphQL::Types::String, required: false, - description: "Filter pipelines by their source. Will be ignored if `dast_view_scans` feature flag is disabled." + description: "Filter pipelines by their source." end class_methods do @@ -38,8 +38,6 @@ def resolver_complexity(args, child_complexity:) end def resolve_pipelines(project, params = {}) - params.delete(:source) unless Feature.enabled?(:dast_view_scans, project, default_enabled: :yaml) - Ci::PipelinesFinder.new(project, context[:current_user], params).execute end end diff --git a/config/feature_flags/development/dast_view_scans.yml b/config/feature_flags/development/dast_view_scans.yml deleted file mode 100644 index 736fcb0109123..0000000000000 --- a/config/feature_flags/development/dast_view_scans.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: dast_view_scans -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69571 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/340388 -milestone: '14.3' -type: development -group: group::dynamic analysis -default_enabled: true diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 465c302783842..fa7ab25e2f5af 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -9140,7 +9140,7 @@ four standard [pagination arguments](#connection-pagination-arguments): | <a id="commitpipelinesref"></a>`ref` | [`String`](#string) | Filter pipelines by the ref they are run for. | | <a id="commitpipelinesscope"></a>`scope` | [`PipelineScopeEnum`](#pipelinescopeenum) | Filter pipelines by scope. | | <a id="commitpipelinessha"></a>`sha` | [`String`](#string) | Filter pipelines by the sha of the commit they are run for. | -| <a id="commitpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. Will be ignored if `dast_view_scans` feature flag is disabled. | +| <a id="commitpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. | | <a id="commitpipelinesstatus"></a>`status` | [`PipelineStatusEnum`](#pipelinestatusenum) | Filter pipelines by their status. | ### `ComplianceFramework` @@ -11893,7 +11893,7 @@ four standard [pagination arguments](#connection-pagination-arguments): | <a id="mergerequestpipelinesref"></a>`ref` | [`String`](#string) | Filter pipelines by the ref they are run for. | | <a id="mergerequestpipelinesscope"></a>`scope` | [`PipelineScopeEnum`](#pipelinescopeenum) | Filter pipelines by scope. | | <a id="mergerequestpipelinessha"></a>`sha` | [`String`](#string) | Filter pipelines by the sha of the commit they are run for. | -| <a id="mergerequestpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. Will be ignored if `dast_view_scans` feature flag is disabled. | +| <a id="mergerequestpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. | | <a id="mergerequestpipelinesstatus"></a>`status` | [`PipelineStatusEnum`](#pipelinestatusenum) | Filter pipelines by their status. | ##### `MergeRequest.reference` @@ -12927,7 +12927,7 @@ Represents a file or directory in the project repository that has been locked. | <a id="pipelineconfigsource"></a>`configSource` | [`PipelineConfigSourceEnum`](#pipelineconfigsourceenum) | Configuration source of the pipeline (UNKNOWN_SOURCE, REPOSITORY_SOURCE, AUTO_DEVOPS_SOURCE, WEBIDE_SOURCE, REMOTE_SOURCE, EXTERNAL_PROJECT_SOURCE, BRIDGE_SOURCE, PARAMETER_SOURCE, COMPLIANCE_SOURCE). | | <a id="pipelinecoverage"></a>`coverage` | [`Float`](#float) | Coverage percentage. | | <a id="pipelinecreatedat"></a>`createdAt` | [`Time!`](#time) | Timestamp of the pipeline's creation. | -| <a id="pipelinedastprofile"></a>`dastProfile` | [`DastProfile`](#dastprofile) | DAST profile associated with the pipeline. Returns `null`if `dast_view_scans` feature flag is disabled. | +| <a id="pipelinedastprofile"></a>`dastProfile` | [`DastProfile`](#dastprofile) | DAST profile associated with the pipeline. | | <a id="pipelinedetailedstatus"></a>`detailedStatus` | [`DetailedStatus!`](#detailedstatus) | Detailed status of the pipeline. | | <a id="pipelinedownstream"></a>`downstream` | [`PipelineConnection`](#pipelineconnection) | Pipelines this pipeline will trigger. (see [Connections](#connections)) | | <a id="pipelineduration"></a>`duration` | [`Int`](#int) | Duration of the pipeline in seconds. | @@ -13359,7 +13359,7 @@ Returns [`DastProfile`](#dastprofile). | Name | Type | Description | | ---- | ---- | ----------- | -| <a id="projectdastprofilehasdastprofileschedule"></a>`hasDastProfileSchedule` | [`Boolean`](#boolean) | Filter DAST Profiles by whether or not they have a schedule. Will be ignored if `dast_view_scans` feature flag is disabled. | +| <a id="projectdastprofilehasdastprofileschedule"></a>`hasDastProfileSchedule` | [`Boolean`](#boolean) | Filter DAST Profiles by whether or not they have a schedule. | | <a id="projectdastprofileid"></a>`id` | [`DastProfileID!`](#dastprofileid) | ID of the DAST Profile. | ##### `Project.dastProfiles` @@ -13376,7 +13376,7 @@ four standard [pagination arguments](#connection-pagination-arguments): | Name | Type | Description | | ---- | ---- | ----------- | -| <a id="projectdastprofileshasdastprofileschedule"></a>`hasDastProfileSchedule` | [`Boolean`](#boolean) | Filter DAST Profiles by whether or not they have a schedule. Will be ignored if `dast_view_scans` feature flag is disabled. | +| <a id="projectdastprofileshasdastprofileschedule"></a>`hasDastProfileSchedule` | [`Boolean`](#boolean) | Filter DAST Profiles by whether or not they have a schedule. | ##### `Project.dastSiteProfile` @@ -13836,7 +13836,7 @@ four standard [pagination arguments](#connection-pagination-arguments): | <a id="projectpipelinesref"></a>`ref` | [`String`](#string) | Filter pipelines by the ref they are run for. | | <a id="projectpipelinesscope"></a>`scope` | [`PipelineScopeEnum`](#pipelinescopeenum) | Filter pipelines by scope. | | <a id="projectpipelinessha"></a>`sha` | [`String`](#string) | Filter pipelines by the sha of the commit they are run for. | -| <a id="projectpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. Will be ignored if `dast_view_scans` feature flag is disabled. | +| <a id="projectpipelinessource"></a>`source` | [`String`](#string) | Filter pipelines by their source. | | <a id="projectpipelinesstatus"></a>`status` | [`PipelineStatusEnum`](#pipelinestatusenum) | Filter pipelines by their status. | ##### `Project.projectMembers` diff --git a/ee/app/controllers/projects/on_demand_scans_controller.rb b/ee/app/controllers/projects/on_demand_scans_controller.rb index a3dfac454edaf..d321eaa206f11 100644 --- a/ee/app/controllers/projects/on_demand_scans_controller.rb +++ b/ee/app/controllers/projects/on_demand_scans_controller.rb @@ -11,7 +11,6 @@ class OnDemandScansController < Projects::ApplicationController feature_category :dynamic_application_security_testing def index - redirect_to new_project_on_demand_scan_path(project) unless Feature.enabled?(:dast_view_scans, @project, default_enabled: :yaml) end def new diff --git a/ee/app/graphql/ee/types/ci/pipeline_type.rb b/ee/app/graphql/ee/types/ci/pipeline_type.rb index 68cb247611119..21a4fcfff7400 100644 --- a/ee/app/graphql/ee/types/ci/pipeline_type.rb +++ b/ee/app/graphql/ee/types/ci/pipeline_type.rb @@ -28,15 +28,14 @@ module PipelineType field :dast_profile, ::Types::Dast::ProfileType, null: true, - description: 'DAST profile associated with the pipeline. Returns `null`' \ - 'if `dast_view_scans` feature flag is disabled.' + description: 'DAST profile associated with the pipeline.' def code_quality_reports pipeline.codequality_reports.sort_degradations!.values.presence end def dast_profile - pipeline.dast_profile if ::Feature.enabled?(:dast_view_scans, pipeline.project, default_enabled: :yaml) + pipeline.dast_profile end end end diff --git a/ee/app/graphql/resolvers/app_sec/dast/profile_resolver.rb b/ee/app/graphql/resolvers/app_sec/dast/profile_resolver.rb index e5edcb3583bb6..f9c5eca26bcb0 100644 --- a/ee/app/graphql/resolvers/app_sec/dast/profile_resolver.rb +++ b/ee/app/graphql/resolvers/app_sec/dast/profile_resolver.rb @@ -12,7 +12,7 @@ class ProfileResolver < BaseResolver argument :has_dast_profile_schedule, ::GraphQL::Types::Boolean, required: false, - description: 'Filter DAST Profiles by whether or not they have a schedule. Will be ignored if `dast_view_scans` feature flag is disabled.' + description: 'Filter DAST Profiles by whether or not they have a schedule.' when_single do argument :id, ::Types::GlobalIDType[::Dast::Profile], @@ -21,7 +21,6 @@ class ProfileResolver < BaseResolver end def resolve_with_lookahead(**args) - args.delete(:has_dast_profile_schedule) unless Feature.enabled?(:dast_view_scans, project, default_enabled: :yaml) apply_lookahead(find_dast_profiles(args)) end diff --git a/ee/lib/ee/sidebars/projects/menus/security_compliance_menu.rb b/ee/lib/ee/sidebars/projects/menus/security_compliance_menu.rb index 3f8044e76db65..838accb780aef 100644 --- a/ee/lib/ee/sidebars/projects/menus/security_compliance_menu.rb +++ b/ee/lib/ee/sidebars/projects/menus/security_compliance_menu.rb @@ -91,11 +91,7 @@ def on_demand_scans_menu_item return ::Sidebars::NilMenuItem.new(item_id: :on_demand_scans) end - link = if ::Feature.enabled?(:dast_view_scans, context.project, default_enabled: :yaml) - project_on_demand_scans_path(context.project) - else - new_project_on_demand_scan_path(context.project) - end + link = project_on_demand_scans_path(context.project) ::Sidebars::MenuItem.new( title: s_('OnDemandScans|On-demand scans'), 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 e92c41179ed53..d80f94669bc69 100644 --- a/ee/spec/requests/api/graphql/project/dast_profiles_spec.rb +++ b/ee/spec/requests/api/graphql/project/dast_profiles_spec.rb @@ -109,33 +109,13 @@ def pagination_results_data(dast_profiles) expect { subject }.not_to exceed_query_limit(control) end - context 'when `dast_view_scans` feature flag is disabled' do - before do - stub_feature_flags(dast_view_scans: false) - end - - context 'when hasDastProfileSchedule is false' do - let(:query_args) { { hasDastProfileSchedule: false } } - - include_examples 'returns all dastProfiles' - end - - context 'when hasDastProfileSchedule is true' do - let(:query_args) { { hasDastProfileSchedule: true } } + context 'when hasDastProfileSchedule is true' do + let(:query_args) { { hasDastProfileSchedule: true } } - include_examples 'returns all dastProfiles' - end - end - - context 'when `dast_view_scans` feature flag is enabled' do - context 'when hasDastProfileSchedule is true' do - let(:query_args) { { hasDastProfileSchedule: true } } - - it 'returns all dastProfiles with a schedule' do - subject + it 'returns all dastProfiles with a schedule' do + subject - expect(graphql_data_at(:project, :dast_profiles, :nodes, :id)).to contain_exactly(dast_profile5.to_global_id.to_s) - end + expect(graphql_data_at(:project, :dast_profiles, :nodes, :id)).to contain_exactly(dast_profile5.to_global_id.to_s) end end end diff --git a/ee/spec/requests/api/graphql/project/pipelines/dast_profile_spec.rb b/ee/spec/requests/api/graphql/project/pipelines/dast_profile_spec.rb index 5f21abe632b15..f50a455a73105 100644 --- a/ee/spec/requests/api/graphql/project/pipelines/dast_profile_spec.rb +++ b/ee/spec/requests/api/graphql/project/pipelines/dast_profile_spec.rb @@ -78,16 +78,6 @@ expect { subject }.not_to exceed_query_limit(control) expect(dast_profile_data.size).to eq(6) end - - context 'when feature flag is not enabled' do - it 'does not return dast profile data' do - stub_feature_flags(dast_view_scans: false) - - subject - - expect(dast_profile_data).to contain_exactly(nil) - end - end end end end diff --git a/ee/spec/requests/projects/on_demand_scans_controller_spec.rb b/ee/spec/requests/projects/on_demand_scans_controller_spec.rb index 09f75875c698b..97593b2243f02 100644 --- a/ee/spec/requests/projects/on_demand_scans_controller_spec.rb +++ b/ee/spec/requests/projects/on_demand_scans_controller_spec.rb @@ -73,20 +73,6 @@ it_behaves_like 'on-demand scans page' do let(:path) { project_on_demand_scans_path(project) } end - - context 'when dast_view_scans feature flag is disabled' do - before do - stub_licensed_features(security_on_demand_scans: true) - stub_feature_flags(dast_view_scans: false) - project.add_developer(user) - login_as(user) - get project_on_demand_scans_path(project) - end - - it 'redirects to new on-demands scans form' do - expect(response).to redirect_to(new_project_on_demand_scan_path(project)) - end - end end describe 'GET #new' do diff --git a/ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index 8351d96358c27..73840f790bde9 100644 --- a/ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -210,22 +210,6 @@ expect(rendered).to have_link('Audit events', href: project_audit_events_path(project)) end end - - context 'when dast_view_scans feature flag is disabled' do - before do - allow(view).to receive(:current_user).and_return(user) - stub_feature_flags(dast_view_scans: false) - stub_licensed_features( - security_on_demand_scans: true - ) - - render - end - - it 'links to on-demand scans form instead of index page' do - expect(rendered).to have_link('On-demand scans', href: new_project_on_demand_scan_path(project)) - end - end end describe 'Operations' do diff --git a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb index 3fcfa967452cc..9fe4c78f551d6 100644 --- a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb +++ b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb @@ -62,24 +62,12 @@ def resolve(**args) context 'filtering by source' do let_it_be(:source_pipeline) { create(:ci_pipeline, project: project, source: 'web') } - context 'when `dast_view_scans` feature flag is disabled' do - before do - stub_feature_flags(dast_view_scans: false) - end - - it 'does not filter by source' do - expect(resolve_pipelines(source: 'web')).to contain_exactly(*all_pipelines, source_pipeline) - end + it 'does filter by source' do + expect(resolve_pipelines(source: 'web')).to contain_exactly(source_pipeline) end - context 'when `dast_view_scans` feature flag is enabled' do - it 'does filter by source' do - expect(resolve_pipelines(source: 'web')).to contain_exactly(source_pipeline) - end - - it 'returns all the pipelines' do - expect(resolve_pipelines).to contain_exactly(*all_pipelines, source_pipeline) - end + it 'returns all the pipelines' do + expect(resolve_pipelines).to contain_exactly(*all_pipelines, source_pipeline) end end -- GitLab