SCA Guardrails
Enforces Software Composition Analysis scanning standards. Ensures SCA scanners run and validates vulnerability thresholds for dependency security.
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.
executed
Verifies that SCA scanning was executed on the component. Fails if no scanner has written to .sca.
max-severity
Ensures no findings at or above the configured severity threshold. Configure min_severity to set the threshold (critical, high, medium, low).
max-total
Ensures total vulnerabilities are under a configurable threshold.
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 →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 GitHubSCA 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:
executedfailure: Configure an SCA scanner (Snyk, Semgrep Supply Chain, Dependabot) in your CI pipeline or as a GitHub App integration.max-severityfailure: Review and remediate the flagged vulnerabilities by updating to patched versions or using your scanner's ignore feature for accepted risks.max-totalfailure: 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.
Common Use Cases
Explore how individual guardrails work with specific integrations.
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.