Configure Secret Detection via an MR [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
This makes it possible to configure Secret Detection via an automatically created MR from the Security Configuration page.
How to test this?
Note that the backend doesn't yet support this feature, it is therefor hidden behind a feature flag, and the GraphQL mutation needs to be mocked in order for the feature to be fully tested.
- Enable the
sec_secret_detection_ui_enable
feature flag.
echo "Feature.enable(:sec_secret_detection_ui_enable)" | rails c
- Apply this patch to mock the mutation:
diff --git a/ee/app/assets/javascripts/security_configuration/graphql/configure_secret_detection.mutation.graphql b/ee/app/assets/javascripts/security_configuration/graphql/configure_secret_detection.mutation.graphql
index 2fd4b0982df..1d8cbee288a 100644
--- a/ee/app/assets/javascripts/security_configuration/graphql/configure_secret_detection.mutation.graphql
+++ b/ee/app/assets/javascripts/security_configuration/graphql/configure_secret_detection.mutation.graphql
@@ -1,5 +1,5 @@
mutation configureSecretDetection($fullPath: ID!) {
- configureSecretDetection(fullPath: $fullPath) {
+ configureSecretDetection(fullPath: $fullPath) @client {
successPath
errors
}
diff --git a/ee/app/assets/javascripts/security_configuration/graphql/provider.js b/ee/app/assets/javascripts/security_configuration/graphql/provider.js
index ef96b443da8..25be7103bd2 100644
--- a/ee/app/assets/javascripts/security_configuration/graphql/provider.js
+++ b/ee/app/assets/javascripts/security_configuration/graphql/provider.js
@@ -2,8 +2,20 @@ import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
+const resolvers = {
+ Mutation: {
+ configureSecretDetection: () => {
+ return {
+ successPath: '/success',
+ errors: [],
+ __typename: 'configureSecretDetection',
+ };
+ },
+ },
+};
+
Vue.use(VueApollo);
export default new VueApollo({
- defaultClient: createDefaultClient(),
+ defaultClient: createDefaultClient(resolvers),
});
Screenshots (strongly suggested)
Before | After |
---|---|
![]() |
![]() |
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 is behind a feature flag .
-
- [-] Documentation (if required)
- [-] 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 #321281 (closed)
Edited by Paul Gascou-Vaillancourt