Permissions Declared + GitHub Actions Collector
Enforce Permissions Declared using data collected by GitHub Actions Collector. Automatically check security and compliance standards on every PR.
How GitHub Actions Collector Powers This Guardrail
The GitHub Actions Collector gathers metadata from your systems. This data flows into Lunar's Component JSON, where the Permissions Declared 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 GitHub Actions Collector
collectors:
- uses: github://earthly/lunar-lib/collectors/github-actions@v1.0.5
# with: ...
# Step 2: Enable the GitHub Actions Security Guardrails
policies:
- uses: github://earthly/lunar-lib/policies/github-actions@v1.0.5
include: [permissions-declared]
# with: ...
What GitHub Actions Collector Collects
This collector gathers the following data that the Permissions Declared guardrail evaluates.
workflows
Parses all GitHub Actions workflow files in .github/workflows/, runs actionlint for lint errors, and classifies action version pinning (SHA, tag, branch, unpinned) for supply-chain hygiene.
Example Data Flow
Here's an example of the data that GitHub Actions Collector writes to the Component JSON, which Permissions Declared then evaluates.
{
"ci": {
"lint": {
"source": { "tool": "actionlint", "version": "1.7.7", "integration": "code" },
"errors": [
{
"file": ".github/workflows/ci.yml",
"line": 42,
"column": 9,
"message": "property \"unknown_field\" is not defined",
"rule": "syntax-check"
}
],
"error_count": 1,
"warning_count": 0
},
"dependencies": {
"source": { "tool": "github-actions", "version": "0.1.0", "integration": "code" },
"total": 3,
"pinned": 2,
"unpinned": 1,
"items": [
{ "name": "actions/checkout", "ref": "abc123def456", "pinning": "sha", "party": "1st" },
{ "name": "docker/build-push-action", "ref": "v5.1.0", "pinning": "tag", "party": "3rd" },
{ "name": "docker/login-action", "ref": "main", "pinning": "branch", "party": "3rd" }
],
"third_party_unpinned": ["docker/login-action@main"]
},
"native": {
"github_actions": {
"source": { "tool": "github-actions", "version": "0.1.0", "integration": "code" },
"workflows": [
{
"file": ".github/workflows/ci.yml",
"name": "CI",
"triggers": ["push", "pull_request"],
"jobs": {
"build": {
"steps": [
{ "uses": "actions/checkout@abc123def456", "with": { "persist-credentials": false } },
{ "run": "make build" }
]
},
"test": {
"steps": [
{ "uses": "actions/checkout@abc123def456" },
{ "run": "make test" }
]
}
},
"permissions": { "contents": "read" },
"actions": [
{ "uses": "actions/checkout@abc123def456", "pinning": "sha", "party": "1st" },
{ "uses": "docker/build-push-action@v5.1.0", "pinning": "tag", "party": "3rd" },
{ "uses": "docker/login-action@main", "pinning": "branch", "party": "3rd" }
]
}
]
}
}
}
}
Configuration Options
GitHub Actions Security Guardrails Inputs
| Input | Required | Default | Description |
|---|---|---|---|
exempt_jobs |
Required | — | Workflow jobs exempt from `checkout-no-persist-credentials`, for a risk that has been reviewed and accepted. Entries are `<workflow-file>:<job-id>`, separated by newlines or commas: ```yaml with: exempt_jobs: | # accepted TICKET-123 — repo-scoped 1h token, no artifact upload .github/workflows/publish.yaml:push ``` The workflow matches the collected path or its bare filename; the job id is the key under `jobs:`. `#` comments are ignored, so the rationale can sit next to the entry it explains. An exemption never turns a finding into a pass. Findings that are not exempt still fail; the check resolves to `skip`, naming each exempted job, only when every finding it made was exempted. An entry that cannot be parsed fails the check without exempting anything. An entry naming a workflow the component has but a job it does not define is reported as stale. An entry whose workflow file the component does not have at all is ignored — one policy entry is normally shared by every component in its scope. |
Ready to Automate Your Standards?
See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 200+ built-in guardrails.