[BE] Extend GraphQL for frontend for CSP
Why are we doing this work
In order for frontend to annotate the group as CSP and the policies as "instance-level policies", we should surface this information from the backend.
We should also ensure that policy scope can be configured for all instance projects and groups.
Relevant links
Non-functional requirements
-
Documentation: -
Feature flag: -
Performance: -
Testing:
Implementation plan
- Extend
ee/app/graphql/ee/types/namespace_type.rbto indicate if a group is a CSP - Extend
merge_project_relationshipinee/app/finders/security/security_policy_base_finder.rband exposeconfig.source.csp - Test and update the code paths to allow proper policy scope configuration by considering all projects / groups in the instance
Verification steps
- Query
cspattribute for a namespace and verify that it returnstruefor a CSP group andfalsefor other groups{ namespace(fullPath: "<group-path>") { id approvalPolicies(relationship: INHERITED) { nodes { name enabled csp } } scanExecutionPolicies(relationship: INHERITED) { nodes { name enabled csp } } vulnerabilityManagementPolicies(relationship: INHERITED) { nodes { name enabled csp } } pipelineExecutionPolicies(relationship: INHERITED) { nodes { name enabled csp } } pipelineExecutionSchedulePolicies(relationship: INHERITED) { nodes { name enabled csp } } } } - Try to assign various groups and projects in the policy scope of the CSP configuration and verify that they are returned in the dropdown results
Edited by Martin Cavoj