Skip to content

Workflow hardening: label-sync and release-drafter break the repo's own pinning and permissions rules #117

Closed

Description

@TMHSDigital

Why it matters

.github/workflows/README.md sets two rules: no ${{ }} expressions inside run: blocks, and permissions: {} at the top of every workflow. Several workflows break these rules, including composite actions that the whole fleet consumes. Nothing below is exploitable as-is: the PR number is an integer, and the callers of the composite action are trusted. These are hardening items, but the documented rules are currently not true.

Evidence

label-sync.yml:

  • Lines 21 and 55 put ${{ github.event.pull_request.number }} straight into run:.
  • Line 54 runs gh label create "$label" --force --color "ededed", which resets the color of existing labels on every PR.
  • Permissions are set at workflow level (line 7).
  • The checkout (line 16) is unnecessary.
  • On fork PRs the token is read-only, so gh pr edit fails.

release-drafter.yml:

  • Line 18 uses a third-party action on a mutable tag (release-drafter/release-drafter@v7) under pull_request_target, with workflow-level contents: write and pull-requests: write (lines 9-11).

permissions: {} rule:

  • Only sync.yml and drift-check.yml follow it.
  • codeql, dependency-review, label-sync, pages, release, release-drafter, stale and validate all grant permissions at workflow level.

Composite actions:

  • .github/actions/drift-check/action.yml puts ${{ inputs.mode }}, ${{ inputs.caller-path }}, ${{ inputs.format }} and the token expression directly into run: (around lines 128-133, 158-161, 191, 198-201).
  • release-doc-sync already routes inputs through env: correctly.

Suggested approach

  • Route every expression through env: and reference it as a quoted shell variable.
  • Create labels only if they are missing, with no --force.
  • Use permissions: {} at the top and grant the minimum at job level.
  • Pin third-party actions to a commit SHA with a version comment, as the pinning convention describes. Dependabot keeps SHA pins updated.
  • Consider adding zizmor or actionlint to validate.yml to enforce all of this automatically.

Done when

  • Every workflow and composite action complies with .github/workflows/README.md.
  • A linter enforces it in CI.

Activity

  1. added
    priority: medium
    security
    on Oct 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

    cipriority: mediumsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions