Documentation
¶
Overview ¶
Package recipelint holds the shipped CI recipes to their security rules: no privileged trigger, every action pinned by SHA, and an agent's job that holds nothing but read access to the code.
Index ¶
Constants ¶
const ( RuleCommentTrigger = "comment-trigger" RuleAgentOpen = "agent-open" RuleAgentContentWrite = "agent-contents-write" RuleSubscriptionToken = "subscription-token" RuleAgentBudget = "agent-budget" )
The rules only the customer profile names. It also names RulePullRequestTarget, RuleAgentIDToken, RuleExpressionInScript, RuleUnpinned, RuleAgentPromptInput, RuleEgressAudit, RuleTwoCaps, RuleJoinAttributes and RuleUnreadable.
const ( // RuleAgentAdminKey is a gateway's admin key or sealing key within the // agent's reach. RuleAgentAdminKey = "agent-admin-key" // RuleGatewayEnvironment is a job that holds a gateway's admin key or // sealing key and names no environment. RuleGatewayEnvironment = "gateway-environment" )
const ( RuleEgressAudit = "egress-audit" RuleEgressEndpoint = "egress-endpoint" )
RuleEgressAudit names harden-runner that leaves a job's egress open or broken: audit mode, block mode with no allowed-endpoints, or a list that harden-runner cannot read. RuleEgressEndpoint names a host a recipe allows that is not one of egressHosts, and telemetry left on, which allows step-security's own hosts. Both are notes and reject nothing.
const ( RuleReportLabel = "report-label" RuleCosignCommit = "cosign-commit" RuleReportExitCodes = "report-exit-codes" )
The rules only a GitLab template can break.
const ( RuleUnreadable = "unreadable" RulePullRequestTarget = "pull-request-target" RuleUnpinned = "unpinned-action" RuleUnrecordedPin = "unrecorded-pin" RuleAgentIDToken = "agent-id-token" RuleIDTokenScope = "id-token-scope" RulePermissions = "explicit-permissions" RuleAgentPermissions = "agent-permissions" RuleAgentGuard = "agent-guard" RuleAgentVersion = "agent-version" RuleUnknownAgent = "unknown-agent" RuleAgentContentFlags = "agent-content-flags" RuleAgentProvider = "agent-provider" RuleAgentTools = "agent-tools" RuleAgentPromptInput = "agent-prompt-input" RuleAgentNoteToken = "agent-note-token" RuleReportJob = "report-job" RuleExpressionInScript = "expression-in-script" RuleFollowUpCode = "follow-up-code" RuleFollowUpArtifact = "follow-up-artifact" )
The rules a finding can name.
const ( RuleIngestPlatform = "ingest-platform" RuleConnectJob = "connect-job" )
RuleIngestPlatform names an ingest step with platform-url that cannot send its rows to Costroid Platform: an input missing, an integration token written into the file, or a job condition that skips the job when only the platform is named. RuleConnectJob names a job that runs costroid connect and holds more than the permission its proof needs.
const ( RulePluginUnpinned = "plugin-unpinned" RulePluginWrites = "plugin-writes" )
RulePluginUnpinned names a plugin part that a later push could change unseen: a marketplace entry from outside the repository, a version that is not exact, or an MCP server fetched from a package registry at no exact version. RulePluginWrites names a part that can do more than read: a hook, or a command, skill or agent that allows a tool not known to only read.
const MarketplaceFile = ".claude-plugin/marketplace.json"
MarketplaceFile is where Claude Code reads a repository's plugin marketplace, by path from the repository's root.
const RuleAgentCheckoutCredentials = "agent-checkout-credentials"
RuleAgentCheckoutCredentials is a checkout in an agent's job that leaves the job's token in the clone's git config, where the agent can read it.
const ( // RuleApprovalCode holds an approval workflow to its event, its token and // no code. RuleApprovalCode = "approval-code" )
An approval workflow runs costroid approve on a pull request review. It runs with this repository's token on an event any reviewer starts, so it holds no code and starts no agent.
const RuleArtifactPath = "artifact-path"
RuleArtifactPath is a download that unpacks an artifact into the runner's temporary directory itself. Costroid's binary and the event file sit there, and the job that uploaded the artifact chose every name in it.
const (
// RuleFollowUpPermissions holds a follow-up's token to what it needs.
RuleFollowUpPermissions = "follow-up-permissions"
)
A follow-up is a workflow_run workflow. It runs in the base repository with that repository's token, after a workflow a fork's pull request could edit, so it holds no code and runs nothing that workflow left behind.
const RuleJoinAttributes = "join-attributes"
RuleJoinAttributes names an agent that costroid run does not start, such as claude-code-action's, whose environment does not give its telemetry the pull request's join keys. costroid run sets them for every agent it starts.
const RuleTwoCaps = "two-caps"
RuleTwoCaps names steps that state different caps for one run. The run is held to one, the read step grades it against the one it is told, and the report states the one the run recorded, so a second figure makes one of them read another cap than the run had.
Variables ¶
This section is empty.
Functions ¶
func EventNames ¶
EventNames lists the events of a workflow's on: key, read through aliases and merge keys as lint reads them. root is the workflow's top mapping.
Types ¶
type Finding ¶
Finding is one line of a file and the rule it breaks. A note uses the same shape and rejects nothing. Severity is set by the customer profile alone.
type Options ¶
type Options struct {
Profile Profile
}
Options are a lint's settings. The zero value lints recipes.
type ReadTools ¶
ReadTools names, for each MCP server a plugin starts, the tools that server lists as only reading. A tool or a server it does not name is taken to write.
type Report ¶
Report is what one lint found. Agents counts the workflows the customer profile judged, the ones with an agent step.
func Lint ¶
Lint checks the files named and every YAML file under the directories named, under the recipe profile.
func LintBytes ¶
LintBytes checks one file. A file that is no workflow, action or GitLab template is a finding, because a rule that sees nothing has proved nothing.
func LintCustomer ¶
LintCustomer checks one of a team's own workflows. Only a workflow with an agent step is judged; any other file passes with nothing said, and Agents stays 0. A file that is not YAML is a high finding, because nothing in it could be judged.
func LintMarketplace ¶
LintMarketplace holds the marketplace at root, and every plugin it lists, to two rules. Each plugin is a directory of the repository, so the commit that holds the marketplace pins it, and the marketplace and the plugin state the same exact version. Each MCP server runs a command on PATH, or a package at an exact version, and every tool a command, skill or agent allows is one that only reads.