Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build policy validation #164

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kartikp10
Copy link
Member

Description

Adds logic for validating code security build policies before creation. This PR directly depends on this update to the SDK PaloAltoNetworks/prisma-cloud-go#40

Motivation and Context

YAML build policy strings should be validated before their creation to avoid unexpected behavior.

This PR adds 3 checks and diagnostics for helping the user fix the issues:

  1. Validates if the policy string is valid YAML
  2. Validates the policy.Rule.Children.Metadata object structure
  3. Validates the definition of the policy against the API (https://prisma.pan.dev/api/cloud/code/policies#operation/validateCustomPolicy)

How Has This Been Tested?

The following tests were conducted:

  • Creation of a run-only policy
  • Creation of a build-only policy
  • Creation of a run + build policy
  • Creation of an invalid build policy

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant