Skip to content
Snippets Groups Projects
Commit ddda6b98 authored by Paul Gascou-Vaillancourt's avatar Paul Gascou-Vaillancourt Committed by Bob Van Landuyt :neckbeard:
Browse files

Remove security_on_demand_scans_site_validation FF

Removes the security_on_demand_scans_site_validation feature flag and
all associated logic.
parent 6ff6a7fe
No related branches found
No related tags found
No related merge requests found
Showing
with 12 additions and 144 deletions
---
name: security_on_demand_scans_site_validation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40685
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/241815
milestone: '13.4'
type: development
group: group::dynamic analysis
default_enabled: true
Loading
Loading
@@ -3061,7 +3061,7 @@ Autogenerated return type of PipelineRetry.
| `dastScannerProfiles` | DastScannerProfileConnection | The DAST scanner profiles associated with the project. |
| `dastSiteProfile` | DastSiteProfile | DAST Site Profile associated with the project. |
| `dastSiteProfiles` | DastSiteProfileConnection | DAST Site Profiles associated with the project. |
| `dastSiteValidations` | DastSiteValidationConnection | DAST Site Validations associated with the project. Always returns no nodes if `security_on_demand_scans_site_validation` is disabled. |
| `dastSiteValidations` | DastSiteValidationConnection | DAST Site Validations associated with the project. |
| `description` | String | Short description of the project. |
| `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` |
| `environment` | Environment | A single environment of the project. |
Loading
Loading
Loading
Loading
@@ -209,12 +209,7 @@ export default {
return this.selectedSiteProfile?.validationStatus === DAST_SITE_VALIDATION_STATUS.PASSED;
},
hasProfilesConflict() {
return (
this.glFeatures.securityOnDemandScansSiteValidation &&
!this.someFieldEmpty &&
this.isActiveScannerProfile &&
!this.isValidatedSiteProfile
);
return !this.someFieldEmpty && this.isActiveScannerProfile && !this.isValidatedSiteProfile;
},
isFormInvalid() {
return this.someFieldEmpty || this.hasProfilesConflict;
Loading
Loading
Loading
Loading
@@ -27,10 +27,7 @@ export default {
computed: {
formattedProfiles() {
return this.profiles.map((profile) => {
const addSuffix = (str) =>
this.glFeatures.securityOnDemandScansSiteValidation
? `${str} (${SCAN_TYPE_LABEL[profile.scanType]})`
: str;
const addSuffix = (str) => `${str} (${SCAN_TYPE_LABEL[profile.scanType]})`;
return {
...profile,
dropdownLabel: addSuffix(profile.profileName),
Loading
Loading
Loading
Loading
@@ -32,8 +32,7 @@ export default {
const suffix = isValidated
? s__('DastProfiles|Validated')
: s__('DastProfiles|Not Validated');
const addSuffix = (str) =>
this.glFeatures.securityOnDemandScansSiteValidation ? `${str} (${suffix})` : str;
const addSuffix = (str) => `${str} (${suffix})`;
return {
...profile,
dropdownLabel: addSuffix(`${profile.profileName}: ${profile.targetUrl}`),
Loading
Loading
Loading
Loading
@@ -12,7 +12,6 @@ import {
import dastSiteValidationsQuery from 'ee/security_configuration/dast_site_validation/graphql/dast_site_validations.query.graphql';
import { fetchPolicies } from '~/lib/graphql';
import { s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { updateSiteProfilesStatuses } from '../graphql/cache_utils';
import ProfilesList from './dast_profiles_list.vue';
 
Loading
Loading
@@ -40,9 +39,7 @@ export default {
},
pollInterval: DAST_SITE_VALIDATION_POLLING_INTERVAL,
skip() {
return (
!this.glFeatures.securityOnDemandScansSiteValidation || !this.urlsPendingValidation.length
);
return !this.urlsPendingValidation.length;
},
result({
data: {
Loading
Loading
@@ -60,7 +57,6 @@ export default {
directives: {
GlTooltip: GlTooltipDirective,
},
mixins: [glFeatureFlagsMixin()],
props: {
fullPath: {
type: String,
Loading
Loading
@@ -112,7 +108,7 @@ export default {
: s__('DastSiteValidation|Validate');
},
shouldShowValidationStatus(status) {
return this.glFeatures.securityOnDemandScansSiteValidation && status !== NONE;
return status !== NONE;
},
hasValidationPassed(status) {
return status === PASSED;
Loading
Loading
@@ -169,10 +165,7 @@ export default {
 
<template #actions="{ profile }">
<gl-button
v-if="
glFeatures.securityOnDemandScansSiteValidation &&
!hasValidationPassed(profile.validationStatus)
"
v-if="!hasValidationPassed(profile.validationStatus)"
:disabled="!canValidateProfile(profile.validationStatus)"
variant="info"
category="tertiary"
Loading
Loading
@@ -181,10 +174,7 @@ export default {
>{{ validateBtnLabel(profile.validationStatus) }}</gl-button
>
<gl-button
v-else-if="
glFeatures.securityOnDemandScansSiteValidation &&
hasValidationPassed(profile.validationStatus)
"
v-else
variant="info"
category="tertiary"
size="small"
Loading
Loading
Loading
Loading
@@ -5,7 +5,6 @@ class OnDemandScansController < Projects::ApplicationController
include SecurityAndCompliancePermissions
 
before_action do
push_frontend_feature_flag(:security_on_demand_scans_site_validation, @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)
end
Loading
Loading
Loading
Loading
@@ -7,7 +7,6 @@ class DastProfilesController < Projects::ApplicationController
 
before_action do
authorize_read_on_demand_scans!
push_frontend_feature_flag(:security_on_demand_scans_site_validation, @project, default_enabled: :yaml)
push_frontend_feature_flag(:dast_saved_scans, @project, default_enabled: :yaml)
end
 
Loading
Loading
Loading
Loading
@@ -83,8 +83,7 @@ module ProjectType
::Types::DastSiteValidationType.connection_type,
null: true,
resolver: ::Resolvers::DastSiteValidationResolver,
description: 'DAST Site Validations associated with the project. Always returns no nodes ' \
'if `security_on_demand_scans_site_validation` is disabled.'
description: 'DAST Site Validations associated with the project.'
 
field :cluster_agent,
::Types::Clusters::AgentType,
Loading
Loading
Loading
Loading
@@ -31,7 +31,6 @@ class Create < BaseMutation
 
def resolve(full_path:, target_url:)
project = authorized_find!(full_path)
raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless allowed?(project)
 
response = ::DastSiteTokens::CreateService.new(
container: project,
Loading
Loading
@@ -45,10 +44,6 @@ def resolve(full_path:, target_url:)
 
private
 
def allowed?(project)
Feature.enabled?(:security_on_demand_scans_site_validation, project, default_enabled: :yaml)
end
def error_response(errors)
{ errors: errors }
end
Loading
Loading
Loading
Loading
@@ -35,7 +35,6 @@ class Create < BaseMutation
 
def resolve(full_path:, dast_site_token_id:, validation_path:, strategy: :text_file)
project = authorized_find!(full_path)
raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless allowed?(project)
 
dast_site_token = dast_site_token_id.find
 
Loading
Loading
@@ -55,10 +54,6 @@ def resolve(full_path:, dast_site_token_id:, validation_path:, strategy: :text_f
 
private
 
def allowed?(project)
Feature.enabled?(:security_on_demand_scans_site_validation, project, default_enabled: :yaml)
end
def error_response(errors)
{ errors: errors }
end
Loading
Loading
Loading
Loading
@@ -3,8 +3,6 @@
module Mutations
module DastSiteValidations
class Revoke < BaseMutation
FEATURE_FLAG = :security_on_demand_scans_site_validation
include FindsProject
 
graphql_name 'DastSiteValidationRevoke'
Loading
Loading
@@ -21,7 +19,6 @@ class Revoke < BaseMutation
 
def resolve(full_path:, normalized_target_url:)
project = authorized_find!(full_path)
raise Gitlab::Graphql::Errors::ResourceNotAvailable, "Feature disabled: #{FEATURE_FLAG}" unless allowed?(project)
 
response = ::DastSiteValidations::RevokeService.new(
container: project,
Loading
Loading
@@ -35,10 +32,6 @@ def resolve(full_path:, normalized_target_url:)
 
private
 
def allowed?(project)
Feature.enabled?(FEATURE_FLAG, project, default_enabled: :yaml)
end
def error_response(errors)
{ errors: errors }
end
Loading
Loading
Loading
Loading
@@ -10,15 +10,7 @@ class DastSiteValidationResolver < BaseResolver
description: 'Normalized URL of the target to be scanned.'
 
def resolve(**args)
return DastSiteValidation.none unless allowed?
DastSiteValidationsFinder.new(project_id: project.id, url_base: args[:normalized_target_urls], most_recent: true).execute
end
private
def allowed?
::Feature.enabled?(:security_on_demand_scans_site_validation, project, default_enabled: :yaml)
end
end
end
Loading
Loading
@@ -29,8 +29,7 @@ def execute
private
 
def allowed?
container.feature_available?(:security_on_demand_scans) &&
Feature.enabled?(:security_on_demand_scans_site_validation, container, default_enabled: :yaml)
container.feature_available?(:security_on_demand_scans)
end
 
def normalize_target_url(target_url)
Loading
Loading
Loading
Loading
@@ -23,7 +23,6 @@ def execute
 
def allowed?
container.feature_available?(:security_on_demand_scans) &&
Feature.enabled?(:security_on_demand_scans_site_validation, container, default_enabled: :yaml) &&
dast_site_token.project == container
end
 
Loading
Loading
Loading
Loading
@@ -23,8 +23,7 @@ def execute
private
 
def allowed?
container.feature_available?(:security_on_demand_scans) &&
Feature.enabled?(:security_on_demand_scans_site_validation, container, default_enabled: :yaml)
container.feature_available?(:security_on_demand_scans)
end
 
def url_base
Loading
Loading
Loading
Loading
@@ -24,8 +24,7 @@ def execute!
private
 
def allowed?
container.feature_available?(:security_on_demand_scans) &&
Feature.enabled?(:security_on_demand_scans_site_validation, container, default_enabled: :yaml)
container.feature_available?(:security_on_demand_scans)
end
 
def dast_site_validation
Loading
Loading
Loading
Loading
@@ -145,7 +145,6 @@ describe('OnDemandScansForm', () => {
newScannerProfilePath,
newSiteProfilePath,
glFeatures: {
securityOnDemandScansSiteValidation: true,
dastSavedScans: true,
},
},
Loading
Loading
@@ -502,24 +501,6 @@ describe('OnDemandScansForm', () => {
expect(findSubmitButton().props('disabled')).toBe(hasConflict);
},
);
describe('securityOnDemandScansSiteValidation feature flag disabled', () => {
beforeEach(() => {
mountShallowSubject({
provide: {
glFeatures: {
securityOnDemandScansSiteValidation: false,
},
},
});
return setFormData();
});
it(`does not report any conflict when user selects ${description}`, () => {
expect(findProfilesConflictAlert().exists()).toBe(false);
expect(findSubmitButton().props('disabled')).toBe(false);
});
});
},
);
 
Loading
Loading
Loading
Loading
@@ -29,7 +29,6 @@ describe('OnDemandScansScannerProfileSelector', () => {
provide: {
scannerProfilesLibraryPath: TEST_LIBRARY_PATH,
newScannerProfilePath: TEST_NEW_PATH,
glFeatures: { securityOnDemandScansSiteValidation: true },
},
slots: {
summary: `<div>${profiles[0].profileName}'s summary</div>`,
Loading
Loading
@@ -89,28 +88,5 @@ describe('OnDemandScansScannerProfileSelector', () => {
});
expect(sel.attributes()).toMatchObject(TEST_ATTRS);
});
describe('feature flag disabled', () => {
beforeEach(() => {
createComponent({
propsData: { profiles },
provide: {
glFeatures: { securityOnDemandScansSiteValidation: false },
},
});
});
it('renders profile selector', () => {
const sel = findProfileSelector();
expect(sel.props()).toEqual({
libraryPath: TEST_LIBRARY_PATH,
newProfilePath: TEST_NEW_PATH,
profiles: scannerProfiles.map((x) => ({ ...x, dropdownLabel: `${x.profileName}` })),
value: null,
});
expect(sel.attributes()).toMatchObject(TEST_ATTRS);
});
});
});
});
Loading
Loading
@@ -33,7 +33,6 @@ describe('OnDemandScansSiteProfileSelector', () => {
siteProfilesLibraryPath: TEST_LIBRARY_PATH,
newSiteProfilePath: TEST_NEW_PATH,
glFeatures: {
securityOnDemandScansSiteValidation: true,
securityDastSiteProfilesAdditionalFields: true,
},
},
Loading
Loading
@@ -95,34 +94,5 @@ describe('OnDemandScansSiteProfileSelector', () => {
});
expect(sel.attributes()).toMatchObject(TEST_ATTRS);
});
describe('feature flags disabled', () => {
beforeEach(() => {
createComponent({
propsData: { profiles },
provide: {
glFeatures: {
securityOnDemandScansSiteValidation: false,
securityDastSiteProfilesAdditionalFields: false,
},
},
});
});
it('renders profile selector', () => {
const sel = findProfileSelector();
expect(sel.props()).toEqual({
libraryPath: TEST_LIBRARY_PATH,
newProfilePath: TEST_NEW_PATH,
profiles: siteProfiles.map((x) => ({
...x,
dropdownLabel: `${x.profileName}: ${x.targetUrl}`,
})),
value: null,
});
expect(sel.attributes()).toMatchObject(TEST_ATTRS);
});
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment