Skip to content
Snippets Groups Projects

Expose policy_scope in security policy graphql API

Merged Sashi Kumar Kumaresan requested to merge sk/432513-policy-scope into master
All threads resolved!

What does this MR do and why?

This MR reinstates the revert MR !146386 (merged) due to gitlab-com/gl-infra/production#17690 (closed)

As a part of Support existing policies as we introduce polic... (#432513 - closed), we want to expose the policy_scope in the graphql query with the compliance frameworks and the projects.

MR acceptance checklist

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

Screenshots or screen recordings

Screenshot_2024-02-22_at_6.09.22_PM

How to set up and validate locally

  1. Create a root level group and create a compliance framework
  2. Create Approval policy with policy scope:
type: approval_policy
name: SRP
description: ''
enabled: true
rules:
  - type: scan_finding
    scanners: []
    vulnerabilities_allowed: 0
    severity_levels: []
    vulnerability_states: []
    branch_type: protected
actions:
  - type: require_approval
    approvals_required: 1
    group_approvers_ids:
      - <ID>
policy_scope:
  compliance_frameworks:
    - id: <ID>
  1. Enable security_policies_policy_scope feature flag: Feature.enable(:security_policies_policy_scope, group) and enable the Security policy scope experimental feature by going to Settings -> General -> Permissions & Group features -> Select Security Policy Scopes checkbox
  2. Go to graphql-explorer and query for approvalPolicies
query{
  group(fullPath:"compliance-policies") {
    approvalPolicies {
      nodes {
        policyScope {
          complianceFrameworks {
            nodes {
              id
              name
            }
          }
          includingProjects {
            nodes {
              id
            }
          }
          excludingProjects {
            nodes {
              id
            }
          }
        }
      }
    }    
  }
}

Addresses #432513 (closed)

Edited by Sashi Kumar Kumaresan

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 1 Message
    📖 This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is recommended. Reviews can happen after you merge.

    Documentation review

    The following files require a review from a technical writer:

    The review does not need to block merging this merge request. See the:

    Reviewer roulette

    Category Reviewer Maintainer
    backend @joseph profile link current availability (UTC+0, same timezone as author) @hraghuvanshi profile link current availability (UTC+5.5, 5.5 hours ahead of author)

    Please check reviewer's status!

    • available Reviewer is available!
    • unavailable Reviewer is unavailable!

    Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.

    If needed, you can retry the 🔁 danger-review job that generated this comment.

    Generated by 🚫 Danger

  • Marcos Rocha
  • added 1 commit

    • 87f5ce3b - Refactor spec and update doc

    Compare with previous version

  • Sashi Kumar Kumaresan changed the description

    changed the description

  • Marcos Rocha approved this merge request

    approved this merge request

  • Marcos Rocha requested review from @Andyschoenen and removed review request for @mc_rocha

    requested review from @Andyschoenen and removed review request for @mc_rocha

  • E2E Test Result Summary

    allure-report-publisher generated test report!

    e2e-test-on-gdk: test report for 87f5ce3b

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Govern      | 66     | 0      | 0       | 0     | 66    | ✅     |
    | Create      | 8      | 0      | 3       | 0     | 11    | ✅     |
    | Package     | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Plan        | 4      | 0      | 0       | 0     | 4     | ✅     |
    | Monitor     | 4      | 0      | 0       | 0     | 4     | ✅     |
    | Data Stores | 2      | 0      | 0       | 0     | 2     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 84     | 0      | 4       | 0     | 88    | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+

    e2e-package-and-test: test report for 87f5ce3b

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Govern      | 272    | 0      | 19      | 0     | 291   | ✅     |
    | Create      | 153    | 0      | 20      | 0     | 173   | ✅     |
    | Package     | 0      | 0      | 2       | 0     | 2     | ➖     |
    | Plan        | 8      | 0      | 0       | 0     | 8     | ✅     |
    | Monitor     | 8      | 0      | 0       | 0     | 8     | ✅     |
    | Data Stores | 4      | 0      | 0       | 0     | 4     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 445    | 0      | 41      | 0     | 486   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
  • Andy Schoenen approved this merge request

    approved this merge request

  • Andy Schoenen resolved all threads

    resolved all threads

  • Andy Schoenen enabled an automatic merge when the pipeline for 745122ff succeeds

    enabled an automatic merge when the pipeline for 745122ff succeeds

  • Andy Schoenen mentioned in commit ac499bf2

    mentioned in commit ac499bf2

  • added workflowcanary label and removed workflowin dev label

  • Artur Fedorov mentioned in merge request !146721 (merged)

    mentioned in merge request !146721 (merged)

  • Artur Fedorov mentioned in merge request !145182 (closed)

    mentioned in merge request !145182 (closed)

  • Please register or sign in to reply
    Loading