Workflow YAML Guard

Flags GitHub Actions workflow patterns that can expose secrets or the repo to pull requests, following GitHub's secure-use guidance.

StopsHelps catch workflows that could leak repo secrets to a pull request

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/workflow-yaml-guard.json

The files land in your project. They're yours to edit.

Usage

workflow-yaml-guard-usage.tsx
import { WorkflowYamlGuard } from "@/components/ui/workflow-yaml-guard"

return <WorkflowYamlGuard label=".github/workflows/preview.yml" defaultValue={WORKFLOW} visibility="public" resolveSha={resolveSha} />

What it catches

  • pull_request_target / workflow_run jobs that check out the PR's code (pwn requests)
  • Untrusted event fields and head_ref interpolated into run scripts
  • Actions pinned to tags instead of a full commit SHA (pin via your resolveSha)
  • Missing or write-all token permissions
  • Secrets echoed, dumped with toJSON or transformed past log masking
  • Self-hosted runners reachable from fork PRs in public repos

Props

WorkflowYamlGuard props
PropTypeDefault
value

Controlled workflow YAML.

string—
defaultValue

Initial YAML when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix.

(value: string) => void—
visibility

Repo visibility. Self-hosted runners reachable from forks are errors on public repos and skipped on private ones.

"public" | "private"—
resolveSha

Looks up the commit SHA for an action's tag (e.g. via the GitHub API). Enables "Pin SHA".

(action: string, ref: string) => Promise<string>—
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{line}`, `{detail}`, `{action}`, `{ref}`, `{sha}` are filled in.

Partial<WorkflowYamlGuardMessages>—

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible <label>; aria-invalid and a role=status issue count
  • Each issue has a button that selects its line, with an aria-label
  • After a fix, focus moves to the next fix or back to the textarea

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Also enforce branch protection, required reviews and restricted token permissions in repository settings.

  • A lightweight, line-aware YAML reader: anchors, complex flow syntax and reusable workflows may be missed
  • Pattern-based review; it does not prove a workflow is safe
  • Composite actions and called workflows are not followed

Rules

Rules last verified:

Confirmed guidance on using an intermediate environment variable for untrusted input and pinning actions to a full-length commit SHA. GitHub Security Lab's pwn-request articles were not re-fetched this round. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What it stops

Helps catch workflows that could leak repo secrets to a pull request

Also known as

github actions · workflow yaml · ci/cd · pull_request_target · secrets · permissions · pin sha · self-hosted runner

Dependencies

Pairs well with