Skip to content

safe_outputs job hoists a handler-scoped github-token into job-level GITHUB_TOKEN, breaking default checkout (403) #77580

Backlog

Description

@jansdhillon

Summary

A handler-scoped github-token under safe-outputs.push-to-pull-request-branch (or any safe-output handler) is hoisted into the shared safe_outputs job's job-level GITHUB_TOKEN env var. Other steps in that job — including the default actions/checkout of the source repository — then run with the handler's scoped PAT instead of the default GITHUB_TOKEN, and fail with a 403 when the PAT lacks access to the source repo.

Repro

Workflow frontmatter scopes a docs token to one handler only:

safe-outputs:
  create-pull-request:
    title-prefix: "build: "
    # (own-repo PR; should use the default GITHUB_TOKEN)
  push-to-pull-request-branch:
    target-repo: canonical/landscape-documentation
    github-token: ${{ secrets.LANDSCAPE_DOCS_TOKEN }}   # scoped to the docs handler

LANDSCAPE_DOCS_TOKEN is a PAT with contents:write + pull-requests:write on canonical/landscape-documentation only. It has no access to the workflow's own repo (canonical/landscape-server).

The compiled safe_outputs job then contains:

env:
  GITHUB_TOKEN: ${{ secrets.LANDSCAPE_DOCS_TOKEN }}   # hoisted from the handler

and the job's default checkout step ("Checkout repository (gh-aw default)") runs:

git fetch origin +refs/heads/*:refs/remotes/origin/* +98d5d611...:refs/remotes/pull/1877/merge
remote: Write access to repository not granted.
fatal: unable to access 'https://github.com/canonical/landscape-server/': 403

The checkout of the workflow's own repo is authenticated with the docs PAT, which correctly has no rights there.

Expected

A handler-scoped github-token should be confined to that handler's operations. The shared safe_outputs job credential (used for the default checkout and for create-pull-request against the own repo) should remain the default GITHUB_TOKEN unless a global safe-outputs.github-token is explicitly set.

Actual

The first/only handler token found is promoted to the job-level GITHUB_TOKEN env, overriding the default for every step in the job.

Impact

Any workflow that both (a) opens an own-repo PR via create-pull-request and (b) pushes to a different repo via a handler-scoped github-token will fail at the default checkout with 403, because the scoped PAT does not grant access to the workflow repo. There is no per-handler isolation today.

Workaround

None clean. Setting a global safe-outputs.github-token would override the hoist but then applies the same single token to all handlers, defeating per-handler scoping.

Version

gh-aw v1.2.2 (github/gh-aw-actions@53d0749), AWF v0.29.11. Observed on canonical/landscape-server run 43521895268, job safe_outputs (132222430003).

Activity

  1. locked and limited conversation to collaborators on Nov 13, 2026
  2. unlocked this conversation on Nov 13, 2026
  3. 10 remaining items

  4. added
    backlog:safe-outputs-git
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ai-inspectedbacklog:safe-outputs-gitcommunity

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions