Show failed site validations in profiles library
What does this MR do?
This adds alerts at the top of the DAST profiles library to let users know of failed validations and give them easy ways to either retry or revoke said validations.
How to test this?
- Enable the
dast_failed_site_validations
feature flag.
echo "Feature.enable(:dast_failed_site_validations)" | rails c
- Apply the following patch to mock some data client-side:
diff --git a/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/dast_failed_site_validations.query.graphql b/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/dast_failed_site_validations.query.graphql
index 4421c7cf817..9a9d6fb5416 100644
--- a/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/dast_failed_site_validations.query.graphql
+++ b/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/dast_failed_site_validations.query.graphql
@@ -1,5 +1,5 @@
query DastFailedSiteValidations($fullPath: ID!) {
- project(fullPath: $fullPath) {
+ project(fullPath: $fullPath) @client {
validations: dastSiteValidations(normalizedTargetUrls: $urls, status: "FAILED_VALIDATION") {
nodes {
normalizedTargetUrl
diff --git a/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/provider.js b/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/provider.js
index fa23669b615..54014fcd36a 100644
--- a/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/provider.js
+++ b/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/provider.js
@@ -4,6 +4,29 @@ import createDefaultClient from '~/lib/graphql';
Vue.use(VueApollo);
+const resolvers = {
+ Query: {
+ project: () => {
+ return {
+ __typename: 'Project',
+ dastSiteValidations: {
+ __typename: 'DastSiteValidationsNodes',
+ nodes: [
+ {
+ __typename: 'DastSiteValidationNode',
+ normalizedTargetUrl: 'http://example.com:80',
+ },
+ {
+ __typename: 'DastSiteValidationNode',
+ normalizedTargetUrl: 'https://example.com:443',
+ },
+ ],
+ },
+ };
+ },
+ },
+};
+
export default new VueApollo({
- defaultClient: createDefaultClient({}, { assumeImmutableResults: true }),
+ defaultClient: createDefaultClient(resolvers, { assumeImmutableResults: true }),
});
- Navigate to a project's DAST profiles library at
/:namespace/:project/-/security/configuration/dast_profiles
.
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?- [-] I have included a changelog entry.
-
I have not included a changelog entry because this feature is being developed behind a feature flag.
- [-] Documentation (if required) #322609 (closed)
-
Code review guidelines - -] Merge request performance guidelines
-
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Related to #322608 (closed)
Edited by Paul Gascou-Vaillancourt