Skip to content

[TASK] Restrict workflow token permissions across org repositories #96

Closed

Description

@edenreich

Summary

A Moat security audit (v1.0.9, 2026-07-08) found 101 workflows across 29 org repositories that either grant write scopes or omit a top-level permissions: block entirely.

Why this matters

Without a declared permissions: block, every step in the workflow - including third-party actions - runs with the default token scopes. A compromised or typo'd third-party action then inherits far more access than the workflow needs. Restricting each workflow to the minimum scopes turns a hijacked action from a code-push primitive into a read-only nuisance.

Note: the org-level "Workflow permissions" default is already read-only (that check passes), so the exposure is workflows that explicitly request write scopes broader than they need, or rely on defaults without declaring intent.

Scope

All 29 repositories with workflows are affected, including this one. Full list via moat inference-gateway --verbose.

Suggested fix

For each .github/workflows/*.yml:

  1. Add a top-level permissions: block with the minimum scopes needed.
  2. For read-only workflows:
permissions:
  contents: read
  1. For workflows that need write access (release, PR-opening bots), scope the write grant to the specific permission (contents: write, pull-requests: write) rather than omitting the block.

This can be swept mechanically repo-by-repo; the reusable bot workflows (claude.yml, infer.yml, codex.yml) and the fan-out orchestrators in this repo are the highest-leverage place to start since they run with App tokens across the whole org.

Source

Moat check: repositories_workflow_permissions_are_restricted (FAIL, 29/29 repos with workflows).

Activity

  1. added
    security
    on Jul 8, 2026
  2. added theissue type on Jul 8, 2026
  3. moved this to Todo in 2026on Jul 8, 2026
  4. edenreich commented on Jul 8, 2026

    @edenreich
    ContributorAuthor

    Progress update:

    This repo (.github): already compliant - all 15 workflows declare a top-level permissions: block; only release.yml grants write (required by semantic-release).

    Hand-maintained workflows - PRs open adding top-level permissions: contents: read (12 files, 10 repos):

    adl-generated workflows (agent repos' claude.yml/ci.yml, marked DO NOT EDIT): cannot be patched in place - fix goes in the templates, tracked in inference-gateway/adl-cli#251. Agents pick it up on the next regen cycle.

    Remaining flagged workflows are explicit, job-scoped write grants (release/bot workflows) that legitimately need them.

  5. moved this from Todo to QA in 2026on Jul 8, 2026
  6. moved this from QA to Done in 2026on Jul 8, 2026
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

    security

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions