agentleFS
ChiefGyk3DChiefGyk3D/department-of-internal-arguments/.agents/skills/pack-gha-security-dast/SKILL.md

pack-gha-security-dast

Skill166 starsChanged 6 days agoApache-2.0View on GitHub

Checklist and measured gotchas for reviewing or writing GitHub Actions workflows (SHA pinning, least-privilege permissions, caller/reusable-workflow permission matching, expression injection, pull_request_target, egress block mode, branch-protection force-push bypass) and OWASP ZAP / DAST automation (context XML parsing, Java regex scope, loopback scope, sign-in proof, report redaction, digest binding). Load for .github/workflows changes, reusable-workflow callers, security scan jobs, or ZAP configuration. Not for general CI speed or caching questions.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    pull_request_target and workflow_run: run with the base repo's secrets.

    line 20
  2. Distinctive:

    HTTPS probes: Check that the probe keeps the scheme.

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Generated by scripts/generate.py (release 0.4.0) from packs/gha-security-dast/PACK.md, updated 2026-10-30. sha256:afbf6ba1c3dee2996ef0df472c7cd50221d51ec569dc5eaf7997e4ed2b95d814. Do not edit; run the generator. -->

Pack: GitHub Actions security and ZAP/DAST

Status: pilot pack, written 2026-10-08 from the 2026-10-07 session findings. Items marked UNVERIFIED were not reproduced; treat them as questions to check, not facts.

A workflow file is code that runs with credentials. Most defects below were not syntax errors: the gate was green while the control was missing, masked, or satisfied by the wrong evidence. Review the claim a job makes ("scanned", "signed in", "pinned") and ask what proves it.

Checklist: workflows

  1. Pin by commit SHA, with the version in a trailing comment (uses: owner/repo/.github/workflows/x.yml@<40-hex> # vX.Y.Z). Tags and branches move. In a repo that calls several shared workflows, all calls share one pinned commit, and tests or docs that name the old SHA or version move with them. Re-pin every caller together, not only the one that changed.
  2. Least-privilege permissions: at workflow level (default contents: read), widened per job only for what that job needs. No write-all.
  3. Callers must grant every permission a called reusable workflow declares. Permissions are checked statically at parse time, so a job that is skipped at runtime still counts. If the called workflow declares id-token: write and the caller job does not grant it, every run ends in startup_failure. Diff the callee's declared permissions against the caller job's grants.
  4. No ${{ }} inside run: for anything an outsider can influence (issue titles, PR titles and branch names, commit messages, github.head_ref, inputs). Pass it through env: and quote "$VAR" in the script.
  5. pull_request_target and workflow_run run with the base repo's secrets. Never check out or execute PR head code in such a job. If a privileged job must read PR output, treat it as data.
  6. Egress control. Where the runner-hardening step has a block mode, use block with an explicit allow-list; audit mode only reports. UNVERIFIED for any given repo: confirm the mode that is actually configured before claiming the control exists.
  7. No opt-outs to get green. continue-on-error: true, *-continue-on-error: true, require-non-root: false, nosemgrep, || true on a gate step, skipped tests, and narrower scan scope are escalations to the human, never fixes. A pin-asserting test must collect loosely and assert strictly (assert the collection is non-empty; add a negative test with an unpinned @main, a missing version comment, and a second workflow file; confirm it goes red).
  8. Secrets come from the configured secret manager or secrets.*; never from the repo. Do not echo them; do not write them into SARIF, step summaries, or artifacts.
  9. Artifact and digest binding between jobs. A rescan or publish job must consume the bytes an earlier job verified (image by digest, SBOM passed as an artifact), not a re-pulled mutable tag or re-downloaded file. An empty platform or matrix list must fail, not pass with nothing scanned.
  10. Branch protection force-push bypass. REST allow_force_pushes can report enabled while a GraphQL bypass list exists, and a REST PUT of false does not clear it (observed 2026-10-07 on one repo). Check with GraphQL branchProtectionRules { allowsForcePushes bypassForcePushAllowances { ... } } and clear with updateBranchProtectionRule(allowsForcePushes: false, bypassForcePushActorIds: []).

Checklist: ZAP / DAST automation

  1. Parse the context with ZAP's own reader semantics, not yours. ZAP reads each element's own text. A check using Python itertext() accepted a login URL whose loopback host sat in a child element followed by an external host (mixed content, 2026-10-07, ZAP 2.17.0). CDATA, entities, and namespaces are further differentials (a CDATA bypass of the context guard was found the same day). Test hostile files against the real ZapXmlConfiguration rather than reasoning about it.
  2. Scope regexes are Java regexes. Python regex knowledge does not transfer: \Q..\E, possessive and lazy quantifiers, inline flags (?i), \x2f, and top-level | all appeared in bypass attempts. Prefer a grammar whitelist of allowed shapes over blacklisting substrings, and verify candidates with java.util.regex.Pattern.compile and matches. Round-one whitelist grammars were themselves bypassed by /?.*, /*.*, /+.*, unescaped [::1], and :8080@evil forms.
  3. Loopback-only scope. Parse the authority properly: userinfo (host:80@evil), decimal and IPv4-mapped IPv6 hosts, and trailing-dot hosts are all ways a loopback-looking string reaches somewhere else. Both the target URL and every include regex must resolve inside scope.
  4. Sign-in proof. "Signed in" must be proved by a protected request that returns authenticated content as the selected user, and fails closed if it does not. Evidence satisfied by the login response itself, or no evidence at all, allowed anonymous scans to be reported as authenticated (three separate findings, 2026-10-07).
  5. HTTPS probes. Check that the probe keeps the scheme. A probe that sent an origin-form request and dropped the scheme sent plaintext to a TLS port.
  6. Redaction. Credentials and tokens must be scrubbed before reports, SARIF, or logs are written or uploaded, including values echoed back in request/response evidence.
  7. Digest binding. The ZAP image used for the scan is pinned by digest and the scanned artifact is tied to the verified build; see workflow item 9.

GYST callers and release

Rules for a repo whose CI calls the shared reusable workflows of git-your-ship-together (GYST). Each ends with where it was measured: GYST files are in that repo, SAFO files are in scrum-around-and-find-out. A line marked INFERRED was not reproduced.

  1. One commit for every caller. All calls of the shared workflows in a repo name the same commit, each with a version comment (@<40-hex> # vX.Y.Z); a test or doc that names the old pin moves with them. (Source: GYST docs/wiki/Releases-and-supply-chain.md, "Pins by commit SHA"; this repo's CLAUDE.md, last bullet.)
  2. Re-pin every caller when GYST bumps. A change in GYST reaches a caller only when that caller re-pins, so a bump is not done until every caller of every shared workflow moved to the new commit. zizmor fails a comment that names a tag which does not exist. (Source: GYST CHANGELOG.md intro; docs/wiki/Contributing-and-developing.md, "Fetch first".)
  3. The gate is named CI green. Each shared CI workflow ends in a job CI green that needs every other job and fails if any failed; the required check is <caller job> / CI green, one per language. (Source: GYST BASELINE.md section 2; docs/DESIGN.md, "CI".)
  4. Branch protection before the first merge, and read the required check from it. Do not assume the name: gh api repos/OWNER/REPO/branches/main/protection -q '.required_status_checks.checks[].context' and compare to the caller. A caller that lacks a permission the callee declares ends in startup_failure with no check run, so the required check never appears and a merge goes through (see workflow item 3). (Source: GYST docs/wiki/Getting-started.md, "id-token: write", measured 2026-10-03; the command was run read-only on 2026-10-30. The "before the first merge" timing is a stated requirement in issue #70, not a measurement.)
  5. A conflicting PR gets no checks. It has no merge ref, so no pull_request run starts and closing and reopening does nothing. When no checks are reported, read mergeable first: gh api repos/OWNER/REPO/pulls/N -q .mergeable. (Source: SAFO docs/lessons.md, "A pull request with a merge conflict gets no checks at all", GYST issue 114. A null result while GitHub computes it is INFERRED; read again.)
  6. Orphaned CodeQL categories. GitHub closes an alert only when a later analysis of the same category and ref omits it. After a workflow is retired its categories (/language:python) are never analyzed again, so their alerts stay open (25 of 29 on one repo, 2026-10-04). List open alerts' analysis_key, find keys of workflows that no longer exist, then delete that category's last analysis on the default branch through the code-scanning DELETE endpoint (exact call in the source page, which needs ?confirm_delete). Trust the PR check summary ("1 configuration not found"), not the analysis list. (Source: GYST docs/wiki/Security-scanning-explained.md, "Where results land".)
  7. Merge through one tested watcher. It pins the head SHA and requires the CI green check run to exist; a hand-rolled merge-state loop passes on a stale or missing run (five stale watcher reports on 2026-10-25). (Source: SAFO docs/done-means-verified.md, "The rule in four parts" and "Why: 2026-10-25".)
  8. GitHub API limits. A secondary rate limit rejects bursts while the hourly quota still shows headroom: on 2026-10-29 GraphQL "rate limit exceeded" errors arrived with about 3600 of 5000 points left, after a burst of per-card board listings, issue and PR reads, and a per-dispatch lookup (SAFO issue 204). So: serialize requests; wait at least 1 s between writes (POST, PATCH, PUT, DELETE); never list a whole board per card (list once, keep the ids); read through REST rather than gh issue view / gh pr / gh project; on 403 or 429 honor retry-after, else wait for x-ratelimit-reset when x-ratelimit-remaining is 0, else at least a minute; report a limit as "rate limited, retry after T", never as "does not exist" (SAFO issue 204 asks for this). The docs cap concurrency at 100 requests, shared by REST and GraphQL, and say to prefer webhooks to polling. (Source: docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api and .../rate-limits-for-the-rest-api, both read 2026-10-30 with curl, text extracted; SAFO issue 204 body. Which SAFO calls caused the burst is the issue author's account, not reproduced here.)

How to verify (commands)

  • Pins: grep -rnE 'uses: .+@' .github/workflows | grep -vE '@[0-9a-f]{40}( |$)' lists every non-SHA reference (some local ./ actions are expected). Missing version comments: grep -rnE '@[0-9a-f]{40}\s*$' .github/workflows.
  • Interpolation in run steps: grep -rnE '\$\{\{' .github/workflows then inspect each hit that sits inside a run: block.
  • Permissions diff: read the callee's top-level and job-level permissions: and compare to the caller job.
  • Lint: actionlint and zizmor if installed (UNVERIFIED which are installed on a given box; if absent, report NOT RUN).
  • Opt-outs added in a diff: git diff <base>... | grep -nE '^\+.*(continue-on-error: *true|require-non-root: *false|nosemgrep|\|\| *true)'.
  • Pin-guard test bites: temporarily change one pin to @main in a scratch copy and run the test; it must fail.
  • Regex scope: write a small Java snippet (jshell or a one-file class) that runs Pattern.compile(regex).matcher(candidate).matches() over a hostile list.
  • GYST callers: every uses: of the shared workflows shows one commit (grep -rhoE 'git-your-ship-together/\S+@[0-9a-f]{40}' .github/workflows | sed 's/.*@//' | sort -u prints one line). Required check: the gh api command in GYST item 4. Mergeable: item 5.
  • Force-push bypass: gh api graphql -f query='...' as above (UNVERIFIED query text; check the schema with gh api graphql introspection if it errors).

Reviewer reminders

  • Show the mutation: delete the control, confirm something goes red.
  • A green gate plus "73 checks passed" is not evidence for a security claim; the checks may not look at it.
  • Reusable-workflow, ZAP, and artifact-identity semantics are external-system behavior. If you did not run it, say NOT VERIFIED.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.