Skip to content

Conclusion job's GitHub App token is minted with safe-output permissions, not the conclusion job's #73521

Done

Description

@ekbritecore

Analysis

With safe-outputs.github-app, buildConclusionJobSteps (pkg/workflow/notify_comment_conclusion_helpers.go:51) mints the conclusion job's App token from ComputePermissionsForSafeOutputs(data.SafeOutputs) plus checks: read. But every reporting step in that job uses that token:

  • Handle agent failure
  • Report failed jobs
  • Log detection run
  • Record incomplete
  • Process no-op messages

computeConclusionJobPermissions (pkg/workflow/notify_comment.go:167) already works out what those steps need: actions: read, plus issues: write when conclusionMayCreateIssue. Those permissions go only to GITHUB_TOKEN, never to the App mint. So:

Seen on v0.93.5 and v1.0.1. A one-workflow lock shows conclusion permissions: {actions: read, issues: write, ...}, while its mint asks only for permission-issues: write, or only permission-pull-requests: write. safe-outputs.github-app.permissions rejects both actions and issues, so there's no workaround in frontmatter.

Implementation Plan

  1. In notify_comment_conclusion_helpers.go, mint the conclusion App token from computeConclusionJobPermissions(data) instead of ComputePermissionsForSafeOutputs + addAgentFailureChecksPermission.
  2. No extra filtering is needed: convertPermissionsToAppTokenFields already skips scopes with no App equivalent, such as id-token and models.

Tests

  • notify_comment_test.go, for safe-outputs.github-app with only create-pull-request-review-comment:
    • the conclusion mint has permission-actions: read and permission-issues: write;
    • with report-failure-as-issue: false and report-failed-jobs: false, it has no permission-issues.
  • Recompile the existing lock fixtures.

Acceptance criterion

The conclusion job's App mint includes every App-mappable scope that the conclusion job's own permissions: include.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions