Skip to content

safe-outputs.github-app: conclusion job cannot open failure/detection issues (token minted without issues scope) #73291

Done

Description

@ekbritecore

Summary

When safe-outputs.github-app is configured, the conclusion job's reporting steps get the safe-outputs App token. That token is minted with only the permissions the configured safe outputs need. If none of those safe outputs write issues, these steps cannot open or comment on issues:

  • Handle agent failure (report-failure-as-issue)
  • Report failed jobs
  • Log detection run
  • Record incomplete
  • Process no-op messages

So a workflow that only writes pull requests, for example a PR reviewer, loses its failure, failed-job and threat-detection reporting as soon as it switches from a PAT to an App.

Reproduce (v0.93.5, same on v1.0.1)

safe-outputs:
  github-app:
    client-id: ${{ vars.APP_CLIENT_ID }}
    private-key: ${{ secrets.APP_PRIVATE_KEY }}
  create-pull-request-review-comment:
    max: 10
  submit-pull-request-review:
    max: 1

What the compiled lock shows:

  • Both safe_outputs and conclusion mint with only permission-pull-requests: write. v1.0.1 adds permission-checks: read to conclusion.
  • Every reporting step in conclusion uses github-token: ${{ steps.safe-outputs-app-token.outputs.token }}.
  • Handle agent failure has GH_AW_FAILURE_REPORT_AS_ISSUE: 'true'.
  • The conclusion job's own permissions: already include issues: write.

What the source shows:

  • handle_agent_failure.cjs (ensureParentIssue) and handle_detection_runs.cjs create or comment on issues with that client.
  • Neither has a fallback: a refused write is logged (core.error / core.warning) and the run carries on.

Trying to add the scope fails:

  github-app:
    permissions:
      issues: write

→ Unknown property: issues (only App-only read scopes are accepted there).

We found this by reading the compiled lock and the scripts. We did not observe a 403 live, because we turned the reports off before a failure ran.

Expected

Turning on safe-outputs.github-app should not silently disable failure and threat-detection reporting. Any of these would fix it:

  1. Add permission-issues: write to the conclusion mint whenever an issue-writing report is enabled (report-failure-as-issue, failed jobs, detection runs, incomplete or noop as issue).
  2. Run those reporting steps with the job's GITHUB_TOKEN, which already has issues: write.
  3. Allow standard scopes such as issues: write in safe-outputs.github-app.permissions.

Our workaround

  • report-failure-as-issue: false and report-failed-jobs: false.
  • A custom job with detection-gate: status-only and the default token, which reports on the PR instead.
  • This still loses the detection-run log issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions