Skip to content

Enhance dangerous-triggers: flag issue_comment as a dangerous trigger #1606

Description

@dguido

dangerous-triggers currently flags pull_request_target and workflow_run because they run in the context of the base repository. The issue_comment trigger shares this property but is not flagged.

When a workflow triggers on issue_comment:

  • It runs in the context of the base repository, not the fork
  • It has access to repository secrets (including those not exposed to pull_request workflows)
  • GITHUB_TOKEN has the repository's default permissions (often including contents: write)
  • On public repos, any user who can comment on issues/PRs can trigger the workflow — even users with zero repository permissions

This makes issue_comment fundamentally similar to pull_request_target in terms of security posture. All three recent AI agent attack disclosures rely on it:

  • Claude Code Action RCE — issue_comment trigger for Claude Code
  • PromptPwnd — issues and issue_comment triggers for multiple AI agents
  • A real-world bounty report where issue_comment triggered a review agent that checked out PR code and executed an attacker-controlled npx binary

Beyond AI agents, issue_comment is dangerous for any workflow that:

  • Checks out PR code referenced from the comment context
  • Runs commands based on comment content
  • Has write permissions to the repository

Nuance on severity

issue_comment is more commonly used legitimately than pull_request_target — chatops, bot commands, triage automation. This means we need to think about noise.

Some options:

  1. Flag at Medium severity, Medium confidence (lower than pull_request_target's High/Medium), Regular persona
  2. Flag at High severity, Medium confidence, Pedantic persona (only shown to users who opt in)
  3. Flag only when combined with other risk signals (e.g., checkout steps, run: blocks, broad permissions) — but this adds complexity

I'd lean toward option 1: Medium/Medium, Regular persona. It's still an important signal but acknowledges that issue_comment has more legitimate uses.

Proposed change

Add a check to DangerousTriggers::audit_workflow. This likely requires adding a has_issue_comment() method to the Workflow model (similar to the existing has_pull_request_target() and has_workflow_run()).

The finding message could be something like: "issue_comment trigger runs in the base repository context with access to secrets"

Remediation guidance

  • Restrict who can trigger the workflow using if: github.event.comment.author_association == 'MEMBER' or similar conditions
  • Use minimal permissions (permissions: {} at workflow level, explicit per-job)
  • Consider whether pull_request (which runs in the fork context) would suffice
  • Never check out and execute PR code in an issue_comment-triggered workflow
  • Be aware that GITHUB_TOKEN in issue_comment workflows may have broader access than in pull_request workflows

Related

Activity

  1. added
    enhancement
    on Feb 12, 2026
  2. added a commit that references this issue on Feb 12, 2026
    d63c248
  3. dguido commented on Feb 12, 2026

    @dguido
    ContributorAuthor

    PR: #1614

    What was implemented:

    • Added issue_comment to the dangerous-triggers audit at Medium severity / Medium confidence (Regular persona)
    • Added has_issue_comment() to the Workflow model following the existing has_pull_request_target() / has_workflow_run() pattern
    • Enabled the previously-stubbed dangerous_triggers integration test module with 7 tests covering all trigger variants (bare event, bare events list, events with body, combined triggers, and safe workflow)

    Key design decisions:

    • Used Medium/Medium instead of High/Medium (matching the issue's recommendation) to acknowledge issue_comment has more legitimate uses than pull_request_target or workflow_run
    • Annotation message: "issue_comment runs in the base repository context with access to secrets"
    • Default Regular persona (no explicit .persona() call needed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions