Skip to content

    Type a page, a command such as keryn scan, or a rule id.

    ci-ai-agent-actions-v1

    View as Markdown

    10 rules · Keryn Software Licence · rules 0.8.0 · all packs

    How to read a rule
    Severity
    How bad the finding is if it is real: error fails a default gate, warning and info do not.
    Confidence
    P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
    False-positive risk
    low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
    Edge
    The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
    Taxonomy chips
    References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

    seceng.ciagent.agent-step-on-pull-request-target

    Section titled “seceng.ciagent.agent-step-on-pull-request-target”

    error yaml github-actions, claude-code, codex

    An AI coding agent step runs in a workflow triggered by pull_request_target, which executes with repository secrets and a write token while the agent reads attacker-controlled PR text. A fork author can prompt-inject the agent. Trigger on pull_request, or gate the job strictly and never let the agent read fork content.

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: grants authority is given or left unchecked.

    CWE-94 CWE-250 CWE-441 LLM01 LLM06 ASI01 ASI03 ASI05

    Fix: Use the pull_request trigger (no secrets for forks) or require a maintainer-applied label or approval before the agent job runs, give the agent a read-only token, and keep write actions in a separate job that consumes only validated output.

    References: https://docs.github.com/en/actions/reference/security/secure-use · https://github.com/anthropics/claude-code-action/blob/main/docs/security.md · https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as .github/workflows/pr-review.yml and scan it with keryn scan .github --verbose; the finding below appears.

    .github/workflows/pr-review.yml
    name: AI PR review
    on:
    pull_request_target:
    types: [opened, synchronize]
    permissions:
    contents: read
    pull-requests: write
    jobs:
    review:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Review the change
    uses: anthropics/claude-code-action@v1
    with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    prompt: Review this pull request for style and obvious bugs.

    Checked with Keryn’s browser engine when this page was built: it reports seceng.ciagent.agent-step-on-pull-request-target at line 16 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    seceng.ciagent.agent-step-no-author-association-gate

    Section titled “seceng.ciagent.agent-step-no-author-association-gate”

    warning yaml github-actions, claude-code, codex

    An AI agent step is triggered by an issue, issue comment or discussion and no job or step condition checks github.event.comment.author_association (or the actor). Any GitHub user can then trigger the agent with their text. Add an if: that limits it to OWNER, MEMBER or COLLABORATOR.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.

    Edge inspected: grants authority is given or left unchecked.

    CWE-285 CWE-862 LLM06 LLM01 ASI03 ASI01

    Fix: Add if: contains(fromJSON(‘[“OWNER”,“MEMBER”,“COLLABORATOR”]’), github.event.comment.author_association) (or the issue/discussion equivalent) on the job. Many agent actions also check write access themselves; verify that before dismissing this audit.

    References: https://docs.github.com/en/actions/reference/security/secure-use · https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md · https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows

    seceng.ciagent.agent-write-permissions-on-untrusted-trigger

    Section titled “seceng.ciagent.agent-write-permissions-on-untrusted-trigger”

    error yaml github-actions, claude-code, codex

    Workflow runs an AI agent on an externally triggerable event (pull_request_target, issue_comment, issues, discussion) with a broad write token (permissions: write-all, contents: write or pull-requests: write). A prompt-injected agent can push code or alter PRs. Drop to read permissions and perform writes in a separate, non-agent job.

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: grants authority is given or left unchecked.

    CWE-250 CWE-269 LLM06 ASI03 ASI02

    Fix: Set permissions: contents: read (and only the minimum extra scopes) for the agent job; have a second job with write access apply changes after validating the agent’s output or after human approval. A job-level read-only permissions block overrides a workflow-level write block; confirm the effective permissions.

    References: https://docs.github.com/en/actions/tutorials/authenticate-with-github_token · https://docs.github.com/en/actions/reference/security/secure-use · https://github.com/anthropics/claude-code-action/blob/main/docs/security.md

    seceng.ciagent.agent-id-token-write-on-untrusted-trigger

    Section titled “seceng.ciagent.agent-id-token-write-on-untrusted-trigger”

    error yaml github-actions, claude-code, codex

    Workflow runs an AI agent on an externally triggerable event with permissions id-token: write. A prompt-injected agent can request an OIDC token and assume cloud roles trusted for this repository. Remove id-token: write from the agent job.

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: writes one thing writes to another.

    CWE-250 CWE-269 LLM06 ASI03

    Fix: Remove id-token: write from jobs that run agents on untrusted triggers; perform cloud deployment in a separate job that runs only after trusted approval and consumes reviewed artifacts. Some agent actions request id-token for their own GitHub App token exchange; check that the specific action requires it.

    References: https://docs.github.com/en/actions/concepts/security/openid-connect · https://docs.github.com/en/actions/reference/security/secure-use

    error yaml github-actions, claude-code, codex

    Secrets other than the model API key are exported as environment variables to an AI agent step on an externally triggerable event. Anything the agent or its tools can run (including env, printenv) can read and exfiltrate them. Remove the secret from the agent step and handle it in a separate, trusted job.

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: grants authority is given or left unchecked.

    CWE-522 CWE-200 CWE-526 LLM02 LLM06 ASI03 ASI01

    Fix: Give the agent step only the model credential it needs, keep deploy tokens, cloud keys and PATs out of its environment, and run privileged follow-up work in a separate job that consumes validated output.

    References: https://docs.github.com/en/actions/reference/security/secure-use · https://github.com/anthropics/claude-code-action/blob/main/docs/security.md

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as .github/workflows/issue-helper.yml and scan it with keryn scan .github --verbose; the finding below appears.

    .github/workflows/issue-helper.yml
    name: Issue helper
    on:
    issues:
    types: [opened]
    permissions:
    contents: read
    issues: write
    jobs:
    answer:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Draft a reply
    uses: anthropics/claude-code-action@v1
    env:
    DEPLOY_TOKEN: ${{ secrets.PROD_DEPLOY_TOKEN }}
    with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    prompt: Read the new issue with the gh CLI and draft a helpful reply.

    Checked with Keryn’s browser engine when this page was built: it reports seceng.ciagent.agent-step-env-secrets at line 18 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    seceng.ciagent.agent-allowed-tools-bash-unrestricted

    Section titled “seceng.ciagent.agent-allowed-tools-bash-unrestricted”

    error yaml github-actions, claude-code, codex

    AI agent is allowed unrestricted Bash (bare Bash, Bash(*) or Bash(:*)) through allowed_tools, claude_args or –allowedTools. Once any untrusted text reaches the agent it can run arbitrary commands on the runner. Allow only exact command prefixes such as Bash(npm test:*).

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: grants authority is given or left unchecked.

    CWE-250 CWE-78 LLM06 ASI02 ASI05

    Fix: Replace unrestricted Bash with a minimal list of exact prefixes (for example Bash(npm run lint:*)), disallow network and file-deletion commands, and keep the job token read-only.

    References: https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md · https://github.com/anthropics/claude-code-action/blob/main/docs/security.md

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as .github/workflows/triage.yml and scan it with keryn scan .github --verbose; the finding below appears.

    .github/workflows/triage.yml
    name: Triage
    on:
    issues:
    types: [opened, labeled]
    permissions:
    contents: read
    issues: write
    jobs:
    triage:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: anthropics/claude-code-action@v1
    with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    prompt: Label the newest issue using the repository label list.
    claude_args: --allowedTools "Bash,Read,Grep"

    Checked with Keryn’s browser engine when this page was built: it reports seceng.ciagent.agent-allowed-tools-bash-unrestricted at line 19 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    seceng.ciagent.agent-allowed-tools-dangerous-prefix

    Section titled “seceng.ciagent.agent-allowed-tools-dangerous-prefix”

    warning yaml github-actions, claude-code, codex

    AI agent is allowed a wildcard over a high-impact command prefix (curl, wget, rm, sh, bash, python, node, gh, git, docker…) via allowed_tools, claude_args or –allowedTools. A prompt-injected agent can download payloads, push code or exfiltrate data. Narrow to exact subcommands.

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: calls one thing invokes another.

    CWE-250 CWE-78 LLM06 ASI02 ASI05

    Fix: Allow exact commands (Bash(git diff:*), Bash(npm test:*)) instead of interpreter, network or VCS-write wildcards, and deny curl, wget and shell interpreters explicitly.

    References: https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md · https://github.com/anthropics/claude-code-action/blob/main/docs/security.md

    seceng.ciagent.agent-skip-permissions-flag

    Section titled “seceng.ciagent.agent-skip-permissions-flag”

    error yaml github-actions, claude-code, codex

    AI agent runs in CI with its permission and approval checks disabled (–dangerously-skip-permissions, –dangerously-bypass-approvals-and-sandbox, –yolo, bypassPermissions, sandbox danger-full-access, safety-strategy unsafe). Nothing then stands between a prompt injection and arbitrary command execution on the runner.

    Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.

    Edge inspected: grants authority is given or left unchecked.

    CWE-250 CWE-862 LLM06 ASI02 ASI03 ASI05

    Fix: Remove the bypass flag and use an explicit minimal allow list; if full autonomy is required, run the agent in a disposable container or VM with no secrets, no write token and no network beyond the model API.

    References: https://github.com/anthropics/claude-code-action/blob/main/docs/security.md · https://github.com/openai/codex-action · https://code.claude.com/docs/en/iam · https://raw.githubusercontent.com/openai/codex/main/codex-rs/utils/cli/src/shared_options.rs · https://raw.githubusercontent.com/openai/codex-action/main/action.yml

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as .github/workflows/nightly-fix.yml and scan it with keryn scan .github --verbose; the finding below appears.

    .github/workflows/nightly-fix.yml
    name: Nightly lint fixer
    on:
    schedule:
    - cron: "0 3 * * *"
    workflow_dispatch:
    permissions:
    contents: write
    pull-requests: write
    jobs:
    fix:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-node@v4
    with:
    node-version: 20
    - name: Let the agent fix lint warnings
    run: npx -y @anthropic-ai/claude-code -p "Fix the eslint warnings in src/" --dangerously-skip-permissions
    env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

    Checked with Keryn’s browser engine when this page was built: it reports seceng.ciagent.agent-skip-permissions-flag at line 20 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    seceng.ciagent.agent-pr-head-checkout-on-pull-request-target

    Section titled “seceng.ciagent.agent-pr-head-checkout-on-pull-request-target”

    error yaml github-actions, claude-code, codex

    A pull_request_target workflow checks out the pull request head (head.sha, head.ref or head_ref) in the same job that runs an AI agent. The agent then reads, and may execute, attacker-controlled files such as rules files, scripts and package manifests with a privileged token. Check out the base ref, or run the agent in an unprivileged pull_request workflow.

    Confidence P0: exploitable as written. False-positive risk low: an exact API or flag, so hits are almost always real.

    Edge inspected: calls one thing invokes another.

    CWE-94 CWE-829 CWE-1357 LLM01 LLM06 ASI01 ASI05 ASI04

    Fix: Do not check out PR-head content in a pull_request_target job that holds secrets or a write token. Use pull_request for analysis, or fetch only the diff as data and pass it to the agent in a job with read-only permissions and no secrets.

    References: https://docs.github.com/en/actions/reference/security/secure-use · https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as .github/workflows/docs-check.yml and scan it with keryn scan .github --verbose; the finding below appears.

    .github/workflows/docs-check.yml
    name: Docs check
    on:
    pull_request_target:
    types: [opened, reopened]
    permissions:
    contents: read
    pull-requests: write
    jobs:
    docs:
    runs-on: ubuntu-latest
    steps:
    - name: Check out the proposed change
    uses: actions/checkout@v4
    with:
    ref: ${{ github.event.pull_request.head.sha }}
    - uses: anthropics/claude-code-action@v1
    with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    prompt: Check that the docs in this change match the code.

    Checked with Keryn’s browser engine when this page was built: it reports seceng.ciagent.agent-pr-head-checkout-on-pull-request-target at line 17 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    seceng.ciagent.agent-prompt-interpolates-event-text

    Section titled “seceng.ciagent.agent-prompt-interpolates-event-text”

    error yaml github-actions, claude-code, codex

    Attacker-controlled GitHub event text (issue/PR title or body, comment body, branch name, commit message) is interpolated with ${{ }} straight into an AI agent prompt or command line. The text becomes instructions for the agent and, in run steps, also shell syntax. Pass it as data through an environment variable and tell the agent to treat it as untrusted.

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-77 CWE-94 CWE-78 LLM01 ASI01 ASI05

    Fix: Do not interpolate event fields into prompts. Let the agent fetch the issue or PR through its GitHub tool with a read-only token, or pass the value via env and instruct the agent that the content is untrusted data; never place it on a shell command line.

    References: https://docs.github.com/en/actions/reference/security/secure-use · https://github.com/anthropics/claude-code-action/blob/main/docs/security.md · https://owasp.org/projects/top-10-for-large-language-model-applications

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as .github/workflows/summarize-issue.yml and scan it with keryn scan .github --verbose; the finding below appears.

    .github/workflows/summarize-issue.yml
    name: Summarize issue
    on:
    issues:
    types: [opened]
    permissions:
    contents: read
    issues: write
    jobs:
    summarize:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: anthropics/claude-code-action@v1
    with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    prompt: |
    Summarize this issue in three bullet points.
    Title: ${{ github.event.issue.title }}
    Body: ${{ github.event.issue.body }}

    Checked with Keryn’s browser engine when this page was built: it reports seceng.ciagent.agent-prompt-interpolates-event-text at line 18 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.