List scan profiles in the manage profiles drawer

What does this MR do and why?

List scan profiles in the manage profiles drawer

Fill the manage profiles drawer on the group security configuration
scanners overview page with a profile list beside a read-only detail
pane. ScanProfileList renders the list, and ScanProfileDetail shows the
selected profile's details, reusing ScanTriggersDetail for its scan
triggers. Widen the drawer to fit both panes and give each its own
scroll.

Query the group's profiles from the drawer itself, not the scanners
overview page, so create and delete can refetch later. Filter to the
drawer's scan type in a computed property instead of adding a variable
to a GraphQL document four other components share. Select the first
profile the resolver returns, which orders its results. Scope load
failures to a container inside the drawer, since a page-level alert
renders behind it. Keep the scanners overview table header grey on
hover, since gitlab-ui forces it transparent otherwise.

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/624191

References

Screenshots

before after
scan-profile-drawer-secret-detection-AFTER

How to set up and validate locally

  1. git checkout 624191-list-scan-profiles-in-drawer
    echo "Feature.enable(:custom_secret_detection_profiles_ui)" | gdk rails c
  2. have a GitLab Ultimate licence
  3. go to a group => Secure => Security configuration => Scanners
  4. select Manage profiles on the secret detection row
  5. check the drawer:
    • the left pane lists the secret detection profiles, each with a name, a truncated description and a GitLab or Custom label
    • the right pane shows the selected profile's General details and Scan triggers
    • no profiles of other types (SAST or dependency scanning) appear in the list

with more than one profile

  1. create a custom profile so the list has more than one row, substituting the root group's gid://gitlab/Group/<group_id>

    expand for create mutations
    mutation CreateSecretDetectionProfileWithOneConfiguredTrigger {
      securityScanProfileCreate(
        input: {
          namespaceId: "gid://gitlab/Group/24"
          scanType: SECRET_DETECTION
          name: "Historic scan on default branch"
          description: "Analyzer settings on the default branch pipeline only"
          triggers: [
            {
              triggerType: DEFAULT_BRANCH_PIPELINE
              configuration: {
                secretDetection: {
                  historicScan: true
                  logOptions: "--all --full-history"
                  excludedPaths: ["spec/fixtures/**", "qa/**"]
                  imageSuffix: FIPS
                  secureAnalyzersPrefix: "registry.example.com/security-products"
                  rulesetGitReference: "refs/heads/main"
                }
              }
            }
          ]
        }
      ) {
        errors
        scanProfile {
          id
          name
          description
          scanType
          gitlabRecommended
          triggers
          triggerSettings {
            triggerType
            configuration {
              ... on SecretDetectionConfiguration {
                secureAnalyzersPrefix
                imageSuffix
                historicScan
                logOptions
                excludedPaths
                rulesetGitReference
              }
            }
          }
        }
      }
    }
    mutation {
      securityScanProfileCreate(
        input: {
          namespaceId: "gid://gitlab/Group/24"
          scanType: SECRET_DETECTION
          name: "XSS test <img src=x onerror=alert('profile-name')>"
          description: "\"><script>alert('description')</script> and a [markdown link](javascript:alert('md'))\nsecond line"
          stripDefaults: false
          triggers: [
            {
              triggerType: MERGE_REQUEST_PIPELINE
              configuration: {
                secretDetection: {
                  historicScan: true
                  imageSuffix: FIPS
                  secureAnalyzersPrefix: "<img src=x onerror=alert('secureAnalyzersPrefix')>"
                  excludedPaths: [
                    "<script>alert('excludedPaths')</script>"
                    "\"><img src=x onerror=alert('attr-breakout')>"
                    "{{ constructor.constructor('alert(1)')() }}"
                    "\\u003cimg src=x onerror=alert('double-decode')\\u003e"
                    "<a href=\"javascript:alert('href')\">spec/**</a>"
                  ]
                  logOptions: "--all <svg onload=alert('logOptions-merge-request')>"
                  rulesetGitReference: "javascript:alert('rulesetGitReference')"
                }
              }
            }
            {
              triggerType: DEFAULT_BRANCH_PIPELINE
              configuration: {
                secretDetection: {
                  historicScan: true
                  imageSuffix: FIPS
                  secureAnalyzersPrefix: "<img src=x onerror=alert('secureAnalyzersPrefix')>"
                  excludedPaths: [
                    "<script>alert('excludedPaths')</script>"
                    "\"><img src=x onerror=alert('attr-breakout')>"
                    "{{ constructor.constructor('alert(1)')() }}"
                    "\\u003cimg src=x onerror=alert('double-decode')\\u003e"
                    "<a href=\"javascript:alert('href')\">spec/**</a>"
                  ]
                  logOptions: "--since=2020-01-01 <iframe srcdoc=\"<script>alert(1)</script>\"></iframe>"
                  rulesetGitReference: "<style>body{display:none}</style>refs/tags/v1"
                }
              }
            }
            { triggerType: GIT_PUSH_EVENT }
          ]
        }
      ) {
        scanProfile {
          id
          name
        }
        errors
      }
    }
  2. check that Secret Detection (default) (should be first since !252952 (merged)) is selected when the drawer opens

  3. select another profile and check the right pane swaps to it

to run tests

yarn jest ee/spec/frontend/security_configuration/components/scan_profiles
Edited by Miranda Fluharty

Merge request reports

Loading
Loading