MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / shouldSkipPolicy

Method shouldSkipPolicy

pkg/policies/policy_groups.go:367–383  ·  view source on GitHub ↗

shouldSkipPolicy checks if a policy should be skipped based on the skip list It handles both embedded and referenced policies by loading the policy spec when needed

(ctx context.Context, attachment *v1.PolicyAttachment, skipList []string)

Source from the content-addressed store, hash-verified

365// shouldSkipPolicy checks if a policy should be skipped based on the skip list
366// It handles both embedded and referenced policies by loading the policy spec when needed
367func (pgv *PolicyGroupVerifier) shouldSkipPolicy(ctx context.Context, attachment *v1.PolicyAttachment, skipList []string) (bool, string, error) {
368 if len(skipList) == 0 {
369 return false, "", nil
370 }
371
372 policy, _, err := pgv.loadPolicySpec(ctx, attachment)
373 if err != nil {
374 return false, "", fmt.Errorf("failed to load policy to get name: %w", err)
375 }
376
377 policyName := policy.GetMetadata().GetName()
378 if slices.Contains(skipList, policyName) {
379 return true, policyName, nil
380 }
381
382 return false, "", nil
383}

Callers 2

VerifyMaterialMethod · 0.95
VerifyStatementMethod · 0.95

Calls 3

loadPolicySpecMethod · 0.80
GetNameMethod · 0.65
GetMetadataMethod · 0.65

Tested by

no test coverage detected