Skip to content

--attach cannot work for GitHub App installation tokens — the upload endpoint 404s them even with write access #14309

Open

Description

@Ninodevo

Describe the feature or problem you'd like to solve

The --attach stack (#14186) allowlists OAuth, classic PAT, and fine-grained PAT credentials, so a GitHub App installation token (ghs_) is rejected client-side with "unsupported authentication type".

We tested whether that allowlist is conservative or reflects the endpoint's actual behavior, since our automation runs on an installation token. Calling the endpoint directly from a GitHub Actions run (GITHUB_TOKEN, permissions: contents: write, private repo the token can push to):

POST https://uploads.github.com/user-attachments/assets?name=test.png&content_type=image/png&repository_id=<numeric id>
→ 404 {"message":"Not Found"}

The identical request with an OAuth token (gho_, same repo, WRITE permission) succeeds and returns an asset URL that renders in issues/PRs. So the exclusion is a property of the platform endpoint, not a CLI decision.

Why it matters

Bots and CI are heavy producers of images on issues and PRs: verification screenshots, visual diffs, test artifacts. GitHub App tokens are the recommended identity for exactly that automation, yet they are the one credential class that cannot use the native attachment path. Our workaround today is committing images to a dedicated assets branch and embedding raw/ URLs — the kind of hack --attach was built to retire.

Proposed solution

  1. If the token-type restriction is intentional platform behavior, say so here and route the ask upstream (GitHub CLI: Image upload and attach for issues, PRs, and comments [GA] github/roadmap#1324 makes no mention of credential-type requirements).
  2. If the endpoint can be extended to installation tokens with write access, please allow them and widen uploadTokenTypes accordingly.
  3. Either way, document the credential requirement in the --attach help, alongside the permission requirement requested in --attach requires write access, so outside reporters cannot attach screenshots #14302.
Pinned by BagToad

Activity

  1. added
    needs-triage
    on Sep 1, 2026
  2. cli-triage commented on Sep 1, 2026

    @cli-triage

    Thanks for the detailed report and reproduction. This looks like a legitimate enhancement/documentation request: the --attach allowlist (from #14186) rejects GitHub App installation tokens (ghs_), and you've verified the upload endpoint itself 404s for that token type even with write access. I'm suggesting enhancement (to track widening uploadTokenTypes if the endpoint supports it, or documenting the limitation) and gh-pr since --attach is used in PR/issue workflows. No duplicates found in existing issues (#14194 covers general attachment support and #8747 covers GitHub App auth, but neither addresses this specific token-allowlist/endpoint restriction). A maintainer should confirm whether this is a platform-side restriction to route upstream or a CLI-side allowlist that can be relaxed.

    Generated by Issue Triage (skills-driven) for #14309 · copilot · auto · 22.3 AIC · ⌖ 2.2 AIC · ⊞ 9.7K · ◷

  3. BagToad commented on Sep 2, 2026

    @BagToad
    Member

    Thanks for the request @Ninodevo. This is intended behavior for now, but we may re-evaluate in the future based on demand.

  4. added
    enhancement
    platform
    attachments
    on Sep 2, 2026
  5. github-actions commented on Sep 2, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  6. removed
    needs-triage
    on Sep 2, 2026
  7. comp615 commented on Sep 8, 2026

    @comp615

    Highlighting that we were attempting to change our awkward media -> S3 -> link -> Github process now to use this, and also found it to be ineffective since bots can't use it (and they do a lot of our visual validation).

  8. drogers0 commented on Sep 8, 2026

    @drogers0

    gh-image banner

    While waiting on something first party, gh-image attaches from Actions today. It uses the web upload flow, so no App token is involved: set GH_SESSION_TOKEN from a dedicated bot account.

    It also handles logs, zips and PDFs, not just images and video.

  9. dashashifrina commented on Sep 10, 2026

    @dashashifrina

    +1 this, we are having to do some really silly workarounds and using a dedicated PAT when our whole app functions with app installation tokens. This feels like an arbitrary limitation when installation tokens grant most of the same functionality already.

  10. matthew-gerstman commented on Sep 10, 2026

    @matthew-gerstman

    This makes it much harder for agents to demonstrate on a PR that they've actually verified code works.

  11. EZArchy commented on Sep 10, 2026

    @EZArchy

    @Ninodevo thanks for posting this. Our security policy prohibits long-lived PATs and OAuth tokens for automation. GitHub App installation tokens are the only credential class we're allowed to use in CI. As written, --attach is unusable for us entirely. The feature is great, but excluding the most secure, most recommended token type makes it a human-only tool. We'd love to adopt it the day ghs_ tokens are supported.

    @BagToad we would really need this to be supported.

  12. agustif commented on Sep 10, 2026

    @agustif

    +1 please fix this

    Unusable with unsecure PATs

  13. 32 remaining items

  14. dkattan commented on Oct 30, 2026

    @dkattan

    We are so close guys. Please let the App Installation tokens do this. I don't want to share my PAT with any more bots.

  15. vegardx commented on Nov 1, 2026

    @vegardx

    Same here on GitHub Enterprise Cloud with data residency. With GITHUB_TOKEN (contents: write, pull-requests: write), gh passes its checks and the upload to uploads.$tenant.ghe.com/user-attachments/assets gets a 404, which gh reports as "attaching files requires write access" even though the token has it.

    Two asks:

    1. Return a 403 with a clear message for credentials the endpoint doesn't accept. The 404 sent us debugging our own setup.
    2. Accept installation tokens for repository-scoped uploads.

    The second matters if you want agentic workflows to be usable. Agents and Actions open pull requests that people review, and a visual change needs screenshots as proof. Right now a workflow can capture them but can't attach them without a long-lived bot PAT, which goes against the advice to use short-lived installation tokens. That looks like a big gap.

    We're raising it through our account manager too.

  16. junebash commented on Nov 7, 2026

    @junebash

    Agreed, this totally breaks my agent workflows. The workaround is really quite annoying, and I don't understand the reasoning behind it.

  17. fabiendevos commented on Nov 18, 2026

    @fabiendevos

    Any news on this? Looks like a lot of people (us included) would really like this feature :) I don't want a useless branch or some other silly workaround like using an s3 bucket just for this :)

  18. kinda-dev commented on Nov 18, 2026

    @kinda-dev

    Hey, this would be amazing to have if it ships and would remove plenty of pain from manual implementation on our end.
    Rooting for you!!!

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

    attachmentsblockedenhancementplatform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions