Draft: Show advanced configuration in the profile modal [ci skip]

What does this MR do and why?

Show advanced configuration in the profile modal

Add an Advanced configuration section to the bottom of
ScanProfileDetailsModal, listing the six secret detection analyzer
settings as read-only label and value rows. Extend the
SecurityScanProfile query with triggerSettings and the
SecretDetectionConfiguration union member that carries them.

Select those fields on the modal's own query rather than the shared
ScanProfileFields fragment, which three other queries also use and none
of them render configuration. Read the first trigger that carries a
configuration, because the modal previews a profile while configuration
is stored per trigger. Match on the union member so the section stays
hidden for scan types that resolve to no typed configuration.

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/624190
Changelog: added
EE: true

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. git checkout 624190-add-advanced-configuration-to-profile-modal
  2. have a GitLab Ultimate licence

  3. be Maintainer, Owner or Security Manager on the root group

  4. create a custom secret detection profile with configuration on two triggers

    • open GraphiQL at /-/graphql-explorer and run the mutation below, substituting the root group's gid://gitlab/Group/<group_id>
    expand for the create mutation
    mutation {
      securityScanProfileCreate(
        input: {
          namespaceId: "gid://gitlab/Group/<group_id>"
          scanType: SECRET_DETECTION
          name: "Advanced configuration demo"
          description: "Configuration on the two configurable triggers"
          stripDefaults: false
          triggers: [
            { triggerType: GIT_PUSH_EVENT }
            {
              triggerType: MERGE_REQUEST_PIPELINE
              configuration: {
                secretDetection: {
                  secureAnalyzersPrefix: "registry.gitlab.com/security-products"
                  imageSuffix: FIPS
                  historicScan: true
                  logOptions: "--all"
                  excludedPaths: ["spec/fixtures/**", "**/*.min.js"]
                  rulesetGitReference: "refs/heads/main"
                }
              }
            }
            {
              triggerType: DEFAULT_BRANCH_PIPELINE
              configuration: {
                secretDetection: {
                  imageSuffix: DEFAULT
                  historicScan: false
                }
              }
            }
          ]
        }
      ) {
        scanProfile {
          id
          name
        }
        errors
      }
    }
  5. go to that group => Secure => Security configuration => Scanners tab => Enable scanners => Advanced configuration => Select scanners step

  6. click the secret detection card to enable it, then select the new profile in the dropdown, then click Preview profile to open the modal

  7. check that the modal shows an Advanced configuration section at the bottom, below the trigger cards, with Trigger, Setting and Value columns

  8. check the rows:

    • one per set setting, per configured trigger
    • the Trigger column names which trigger each row belongs to
    • settings left unset do not appear at all
  9. check that SECRET_DETECTION_HISTORIC_SCAN shows No on the default branch trigger rather than being hidden, since false is a set value

changes to the copy in the trigger cards that would conflict with new configuration options

  1. check that the merge request and default branch trigger cards:
    • no longer show a Scope: row
    • no longer promise a full repository scan or every vulnerability in their descriptions
    • still show their Target branch: and Results: rows, which the settings cannot contradict

to run tests

yarn jest ee/spec/frontend/security_configuration/components/scan_profiles

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #624190 (closed)

Edited by Miranda Fluharty

Merge request reports

Loading
Loading