Add security scan profile query type and resolver

What does this MR do and why?

Adds a new scanProfile query that allows fetching individual security scan profiles by their Global ID. This supports both default scan profiles (by scan type enum) and persisted scan profiles.

Changelog: added
EE: true

How to set up and validate locally

  1. Sign in to your GDK as a developer in a group g.
  2. Query using scan type-based global id:
query getSecurityScanProfile {
  securityScanProfile(id: "gid://gitlab/Security::ScanProfile/secret_detection") {
    name
    scanType
    gitlabRecommended
  }
}
  1. Query with a non-existing scan type and verify resource not available error is raised:
query getSecurityScanProfile {
  securityScanProfile(id: "gid://gitlab/Security::ScanProfile/non_existing") {
    name
  }
}
  1. Create and query a persisted profile:
    profile = Security::ScanProfile.create!(
      namespace_id: g.id,
      scan_type: :sast,
      name: 'Custom SAST',
      description: 'Custom config'
    )
    gid = profile.to_global_id.to_s
query getSecurityScanProfile {
  securityScanProfile(id: "gid://gitlab/Security::ScanProfile/<ID>") {
    name
    scanType
    gitlabRecommended
  }
}

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 [Backend] Add scan profile graphql field (#582869) • Gal Katz • 18.7

Edited by Gal Katz

Merge request reports

Loading