Commit 4f37e9d5 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'djadmin-site-validation-refactor' into 'master'

Refactor site validation modal component

See merge request gitlab-org/gitlab!48017
parents b0d463e1 35e8701f
---
name: security_on_demand_scans_http_header_validation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42812
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/276403
milestone: '13.6'
type: development
group: group::dynamic analysis
default_enabled: false
......@@ -11,12 +11,10 @@ import {
GlSkeletonLoader,
GlTruncate,
} from '@gitlab/ui';
import { omit } from 'lodash';
import { __, s__ } from '~/locale';
import * as Sentry from '~/sentry/wrapper';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import download from '~/lib/utils/downloader';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { cleanLeadingSeparator, joinPaths, stripPathTail } from '~/lib/utils/url_utility';
import {
DAST_SITE_VALIDATION_MODAL_ID,
......@@ -44,7 +42,6 @@ export default {
GlSkeletonLoader,
GlTruncate,
},
mixins: [glFeatureFlagsMixin()],
props: {
fullPath: {
type: String,
......@@ -85,14 +82,7 @@ export default {
};
},
validationMethodOptions() {
const isHttpHeaderValidationEnabled = this.glFeatures
.securityOnDemandScansHttpHeaderValidation;
const enabledValidationMethods = omit(DAST_SITE_VALIDATION_METHODS, [
!isHttpHeaderValidationEnabled ? DAST_SITE_VALIDATION_METHOD_HTTP_HEADER : '',
]);
return Object.values(enabledValidationMethods);
return Object.values(DAST_SITE_VALIDATION_METHODS);
},
urlObject() {
try {
......@@ -187,7 +177,7 @@ export default {
await this.$apollo.mutate({
mutation: dastSiteValidationCreateMutation,
variables: {
projectFullPath: this.fullPath,
fullPath: this.fullPath,
dastSiteTokenId: this.tokenId,
validationPath: this.validationPath,
validationStrategy: this.validationMethod,
......
mutation dastSiteValidationCreate(
$projectFullPath: ID!
$fullPath: ID!
$dastSiteTokenId: DastSiteTokenID!
$validationPath: String!
$validationStrategy: DastSiteValidationStrategyEnum
) {
dastSiteValidationCreate(
input: {
fullPath: $projectFullPath
fullPath: $fullPath
dastSiteTokenId: $dastSiteTokenId
validationPath: $validationPath
strategy: $validationStrategy
......
......@@ -6,7 +6,6 @@ module Projects
before_action do
authorize_read_on_demand_scans!
push_frontend_feature_flag(:security_on_demand_scans_site_validation, @project)
push_frontend_feature_flag(:security_on_demand_scans_http_header_validation, @project)
end
feature_category :dynamic_application_security_testing
......
......@@ -51,9 +51,6 @@ describe('DastSiteValidationModal', () => {
{},
{
propsData: defaultProps,
provide: {
glFeatures: { securityOnDemandScansHttpHeaderValidation: true },
},
attrs: {
static: true,
visible: true,
......@@ -287,22 +284,6 @@ describe('DastSiteValidationModal', () => {
});
});
describe('with the "securityOnDemandScansHttpHeaderValidation" feature flag disabled', () => {
beforeEach(() => {
createFullComponent({
provide: {
glFeatures: {
securityOnDemandScansHttpHeaderValidation: false,
},
},
});
});
it('does not render the http-header validation method', () => {
expect(findRadioInputForValidationMethod('header')).toBe(null);
});
});
describe.each(validationMethods)('"%s" validation submission', validationMethod => {
beforeEach(async () => {
createFullComponent();
......@@ -318,7 +299,7 @@ describe('DastSiteValidationModal', () => {
findValidateButton().trigger('click');
expect(requestHandlers.dastSiteValidationCreate).toHaveBeenCalledWith({
projectFullPath: fullPath,
fullPath,
dastSiteTokenId: tokenId,
validationPath: wrapper.vm.validationPath,
validationStrategy: wrapper.vm.validationMethod,
......
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