Skip to main content

Overview

The Policy Management feature provides a Policy as Code approach to security governance. Define your security requirements in YAML or JSON, and CybeDefend will automatically evaluate every scan against your policies.

Hierarchical Policies

Organization → Team → Project hierarchy ensures policies cascade appropriately

Policy as Code

Version-controlled YAML/JSON policies that integrate with your GitOps workflow

Async Evaluation

Non-blocking BullMQ-based worker for fast policy evaluation

Compliance Tracking

Full audit trail and compliance history for governance reporting

Key Features

Policy Hierarchy

Policies are applied in a hierarchical manner, ensuring organizational standards cannot be bypassed:
A policy at a higher level cannot be disabled by a policy at a lower level. Lower-level policies can only add stricter rules.

Automatic Vulnerability Filtering

During policy evaluation, certain vulnerabilities are automatically ignored to focus on active security risks:

Policy Configuration

Policies are defined in YAML format with complete metadata. Here’s a full example:
Policies require 1-15 rules and support a maximum of 30 exclusions.

Rule Types


Operators


Actions


Composite Rules

Use composite rules to combine multiple conditions:

AND Logic (All conditions must match)

OR Logic (Any condition can match)


Exclusions

Exclusions allow you to skip policy evaluation for specific files or patterns:
Pattern matching uses glob patterns:
  • ** matches any number of directories
  • * matches any characters except /
  • ? matches a single character
Always set expiration dates on exclusions to prevent permanent security gaps.

Policy Examples

Branch-Based Policy (Production Protection)

Multi-Scanner Organization Policy


CI/CD Integration

GitHub Actions

Use the official CybeDefend GitHub Action with policy evaluation enabled:

Policy Evaluation Options

GitLab CI

Use the CybeDefend CLI directly with policy evaluation:

CLI Policy Flags

Example Output

If any policy has a BLOCK action with violations, the CLI exits with code 1, failing the pipeline. WARN actions are informational only and don’t affect the exit code.

Managing Violations

When a policy violation occurs, you have two options to resolve it:
1

Change Vulnerability Status

Change the vulnerability status from “open” to “ignored” with a justification. The vulnerability will be excluded from future policy evaluations.
2

Fix the Vulnerability

Resolve the security issue directly in your source code and re-run the scan. The vulnerability will be marked as “resolved” and excluded from policy evaluations.
Both approaches create an audit trail. Changing status to “ignored” requires a comment explaining the risk acceptance decision.

Best Practices

When rolling out policies, start with action: warn to understand the impact before switching to action: block.
Always set expiration dates on exclusions to prevent permanent security gaps:
  • Organization level: Global security requirements (e.g., no exposed secrets)
  • Team level: Team-specific standards (e.g., frontend vs backend rules)
  • Project level: Project-specific exclusions only
Store policy YAML files in your repository:

Related: API Reference - Policy Management · Managing Vulnerabilities · CI/CD Integrations