Hamburger Cross Icon
SCA Guardrails - Lunar Policy for Security And Compliance

SCA Guardrails

Policy Stable Security And Compliance

Enforces Software Composition Analysis scanning standards. Ensures SCA scanners run and validates vulnerability thresholds for dependency security.

Add sca to your lunar-config.yml:
uses: github://earthly/lunar-lib/policies/sca@v1.0.0

Included Guardrails

This policy includes 3 guardrails that enforce standards for your security and compliance.

Guardrail

executed

Verifies that SCA scanning was executed on the component. Fails if no scanner has written to .sca.

sca security scanning compliance dependencies
View Guardrail
Guardrail

max-severity

Ensures no findings at or above the configured severity threshold. Configure min_severity to set the threshold (critical, high, medium, low).

sca critical high vulnerabilities security dependencies
View Guardrail
Guardrail

max-total

Ensures total vulnerabilities are under a configurable threshold.

sca threshold vulnerabilities dependencies
View Guardrail

How Guardrails Fit into Lunar

Lunar guardrails define your engineering standards as code. They evaluate data collected by integrations and produce pass/fail checks with actionable feedback.

Policies support gradual enforcement—from silent scoring to blocking PRs or deployments—letting you roll out standards at your own pace without disrupting existing workflows.

Learn How Lunar Works
1
Integrations Gather Data
Collectors extract metadata from code, CI pipelines, tool outputs, and scans
2
{ } Centralized as JSON
All data merged into each component's unified metadata document
3
Guardrails Enforce Standards This Policy
Real-time feedback in PRs and AI workflows

Required Integrations

This policy evaluates data gathered by one or more of the following integration(s). Make sure to enable them in your lunar-config.yml.

Configuration

Configure this policy in your lunar-config.yml.

Inputs

Input Required Default Description
min_severity Optional high Minimum severity to fail on (critical, high, medium, low)
max_total_threshold Required Maximum total findings allowed (must be configured)

Documentation

View on GitHub

SCA Guardrails

Enforces Software Composition Analysis (SCA) scanning standards for dependency security.

Overview

This policy validates that SCA scanning is configured and enforces vulnerability thresholds for dependencies. It works with any SCA scanner that writes to the normalized .sca path in the Component JSON (Snyk, Semgrep Supply Chain, Dependabot, Grype, etc.).

Policies

This plugin provides the following policies (use include to select a subset):

Policy Description Failure Meaning
executed Verifies SCA scanning ran No scanner has written to .sca
max-severity No findings at or above severity threshold Findings found at configured severity or higher
max-total Total vulnerabilities under threshold Total count exceeds configured limit

Required Data

This policy reads from the following Component JSON paths:

Path Type Provided By
.sca object Any SCA collector (Snyk, Semgrep, etc.)
.sca.vulnerabilities.critical number SCA collector
.sca.vulnerabilities.high number SCA collector
.sca.vulnerabilities.medium number SCA collector
.sca.vulnerabilities.low number SCA collector
.sca.vulnerabilities.total number SCA collector
.sca.summary.has_critical boolean SCA collector (preferred)
.sca.summary.has_high boolean SCA collector (preferred)
.sca.summary.has_medium boolean SCA collector (preferred)
.sca.summary.has_low boolean SCA collector (preferred)

Note: If collectors don't yet write vulnerability counts, the max-severity and max-total checks will fail. Use include: [executed] to only verify the scanner ran until collectors are enhanced.

Installation

Add to your lunar-config.yml:

policies:
  - uses: github://earthly/lunar-lib/policies/sca@main
    on: ["domain:your-domain"]
    enforcement: report-pr
    # include: [executed, max-severity]  # Only run specific checks
    with:
      min_severity: "high"        # Fail on critical and high findings
      max_total_threshold: "10"   # Fail if more than 10 total findings

Examples

Passing Example

{
  "sca": {
    "source": { "tool": "snyk", "integration": "github_app" },
    "vulnerabilities": { "critical": 0, "high": 0, "medium": 3, "total": 8 },
    "summary": { "has_critical": false, "has_high": false }
  }
}

Failing Example

{
  "sca": {
    "source": { "tool": "snyk", "integration": "github_app" },
    "vulnerabilities": { "critical": 2, "high": 5, "medium": 10, "total": 25 },
    "summary": { "has_critical": true, "has_high": true }
  }
}

Failure messages:

  • executed: "No SCA scanning data found. Ensure a scanner (Snyk, Semgrep, etc.) is configured."
  • max-severity: "Critical vulnerability findings detected (2 found)"
  • max-total: "Total vulnerability findings (25) exceeds threshold (10)"

Remediation

When this policy fails, you can resolve it by:

  1. executed failure: Configure an SCA scanner (Snyk, Semgrep Supply Chain, Dependabot) in your CI pipeline or as a GitHub App integration.
  2. max-severity failure: Review and remediate the flagged vulnerabilities by updating to patched versions or using your scanner's ignore feature for accepted risks.
  3. max-total failure: Reduce total vulnerability count by updating dependencies.

Open Source

This policy is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.

View Repository

Ready to Automate Your Standards?

See how Lunar can turn your engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.

Works with any process
check Infrastructure conventions
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Turn any process doc into guardrails
Book a Demo