Skip to content

Secret Detection - MVC to enable within the UI - Backend

Why are we doing this work

We need to add an Enable button on the Secret Detection row within the Security Configuration page. When clicked, the backend will create an MR and the user will be directed to the MR page.

We're going to create a GraphQL endpoint that will create a Merge Request for enabling Category:Secret Detection by updating gitlab_ci.yml. This feature is already enabled for SAST so we can reuse some code.

Relevant links

Non-functional requirements

  • [-] Documentation: is a part of frontend
  • [-] Feature flag: name will be discussed with frontend counterpart. We need to add feature flag to mutation.
  • Testing: unit tests for service and mutation, test in graphql console

Implementation plan

  • Create GraphQL mutation ::Mutations::Security::CiConfiguration::ConfigureSecretDetectionScanning (similar to ConfigureSast)
  • To reuse parts of ConfigureSast extract them into a base mutation ConfigureSecurityAnalyzer
  • Extract reusable parts of Security::CiConfiguration::SastCreateService into some parent service Security::CiConfiguration::BaseCreateService (in future, this base service will go to FOSS)

Specific Implentation if the above is done first for Dependency Scanning in #282533 (closed)

  • Create Security::CiConfiguration::SecretDetectionCreateService
  • Check that all new entities have test coverage and there are no regressions.
  • Create Security::CiConfiguration::SecretDetectionBuildActions
  • Remove ee/app/assets/javascripts/security_configuration/graphql/configure_secret_detection.mutation.graphql from the list of known invalid queries (config/known_invalid_graphql_queries.yml).

Availability and Testing

SET to update existing E2E tests, or create a new E2E test to test that when selected the gitlab-ci is updated. gitlab-org/quality/testcases#1749

Edited by Daniel Paul Searles