Executed + Semgrep Collector
Enforce Executed using data collected by Semgrep Collector. Automatically check security and compliance standards on every PR.
How Semgrep Collector Powers This Guardrail
The Semgrep Collector gathers metadata from your systems. This data flows into Lunar's Component JSON, where the Executed guardrail evaluates it against your standards.
When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.
Quick Start Configuration
Add both the collector and policy to your lunar-config.yml to enable this guardrail.
# Step 1: Enable the Semgrep Collector
collectors:
- uses: github://earthly/lunar-lib/collectors/semgrep@v1.0.0
# with: ...
# Step 2: Enable the SAST Guardrails
policies:
- uses: github://earthly/lunar-lib/policies/sast@v1.0.0
include: [executed]
# with: ...
What Semgrep Collector Collects
This collector gathers the following data that the Executed guardrail evaluates.
github-app
Detects Semgrep GitHub App scans on pull requests by querying GitHub check-runs API. Waits for scan completion and captures results. Categorizes as SAST (Code) or SCA (Supply Chain) based on check name.
running-in-prs
Proves Semgrep is running on PRs by querying Lunar Hub for Semgrep data from recent PRs. Used on the default branch to provide compliance proof that PR scanning is happening (since Semgrep GitHub App only posts checks on PRs, not directly on the default branch).
cli
Detects Semgrep CLI executions in CI pipelines. Captures the command and version. Categorizes based on flags (--supply-chain for SCA, default SAST).
Example Data Flow
Here's an example of the data that Semgrep Collector writes to the Component JSON, which Executed then evaluates.
{
"sast": {
"running_in_prs": true,
"source": {
"tool": "semgrep",
"version": "1.50.0",
"integration": "github_app"
},
"native": {
"semgrep": {
"github_app": {
"id": 12345,
"name": "Semgrep",
"status": "completed",
"conclusion": "success"
},
"cicd": {
"cmds": [
{"cmd": "semgrep scan --config auto", "version": "1.50.0"}
]
}
}
}
}
}
Configuration Options
SAST Guardrails 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) |
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.