Skip to content

--attach requires write access, so outside reporters cannot attach screenshots #14302

Open

Description

@claell

Describe the feature or problem you’d like to solve

First, thank you for shipping this. #13256 and the stack at #14186 closed a request that had been open in one form or another since #1895 in 2020, and the design is better than the workarounds it replaces — being able to write ordinary markdown against local paths and have those references rewritten on upload means a report drafted offline stays readable before it is ever posted. I am very glad to see it land.

One gap, from the read-only side of the fence.

--attach accepts a credential only when its permission on the target repository is ADMIN, MAINTAIN or WRITE:

// uploadPermissions lists the repository permissions that can attach a file.
// The list matches api.Repository.ViewerCanPush, and it is measured against the
// upload endpoint: READ and TRIAGE get a 404.
var uploadPermissions = []string{"ADMIN", "MAINTAIN", "WRITE"}

— internal/attachments/client.go

That excludes the group that most often needs to attach a screenshot to an issue: the outside reporter, who has READ. I use gh to follow up on my own open issues, and viewerPermission is READ on every repository I track — this one included — so --attach is unavailable for all of them:

repository viewerPermission
cli/cli READ
openai/codex READ
microsoft/vscode READ
anthropics/claude-code READ
tauri-apps/tray-icon READ

Meanwhile the same account can drag a screenshot into a comment on any of those repositories through the web UI and it renders. That asymmetry is visible in this tracker: in #12960, drogers0 — author_association: NONE on this repository — posted a github.com/user-attachments/assets/… image scoped to cli/cli, using an extension that replicates the web upload flow with a browser session cookie. So the platform does permit a read-only user to create one of these assets. It is the token-authenticated path that refuses.

Proposed solution

  1. If the 404 for READ/TRIAGE is a property of POST /user-attachments/assets rather than a CLI decision, say so — here, and ideally on GitHub CLI: Image upload and attach for issues, PRs, and comments [GA] github/roadmap#1324, which describes the feature with no mention of a permission requirement. That tells people where the ask actually belongs, which is the same courtesy support image/file attachments in gh issue create and gh issue comment (critical for agentic workflows) #12960 got when the blocker was the missing API.
  2. If the endpoint can serve a user who is permitted to comment on the repository, please allow that. Permission to comment, rather than permission to push, is what gates the equivalent web-UI upload.
  3. Either way, document the requirement in the --attach help. The long help for gh issue create covers the 50-file limit, the alt-text syntax and the partial-failure behaviour, but neither the permission requirement nor the GitHub Enterprise Server exclusion, so a read-only user meets both only as an error.

Point 3 stands on its own and is worth doing even if 1 and 2 are declined.

Additional context

I have not run the preview build — the artifacts linked from #13256 expired on 25 August, and this has not shipped in a release yet (latest is 2.98.0 from 2026-08-20; the stack merged 2026-08-25). The above is read from the merged code on trunk, so please correct me if the released behaviour differs.

Activity

  1. cli-triage commented on Aug 31, 2026

    @cli-triage

    Thanks for the detailed writeup. I'm suggesting the enhancement label: this describes a real gap in the recently-shipped --attach feature (#13256/#14186) where the upload endpoint's permission check (ADMIN/MAINTAIN/WRITE) excludes read-only outside reporters from attaching files, even though the same accounts can upload via the web UI. I checked for duplicates and didn't find an exact match — #14194 and #12960 request the underlying attach capability itself, which has since shipped, so this is a distinct follow-up about the permission requirement and its documentation. A maintainer should confirm whether the READ/TRIAGE restriction is enforced by the platform API itself or is a CLI-side choice, since that determines whether points 1–2 are actionable here versus upstream, though point 3 (documenting the requirement in --attach help) seems actionable regardless.

    Generated by Issue Triage (skills-driven) for #14302 · copilot · auto · 21.4 AIC · ⌖ 2.84 AIC · ⊞ 9.7K · ◷

  2. added
    enhancement
    on Sep 1, 2026
  3. github-actions commented on Sep 1, 2026

    @github-actions
  4. removed
    needs-triage
    on Sep 1, 2026
  5. added
    enhancement
    gh-issue
    and removed
    enhancement
    on Sep 1, 2026
  6. github-actions commented on Sep 1, 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.

  7. added
    gh-pr
    on Sep 1, 2026
  8. added
    platform
    on Sep 1, 2026
  9. drogers0 commented on Sep 8, 2026

    @drogers0

    gh-image banner

    While waiting on something first party, gh-image attaches from read-only access today, so outside reporters can post screenshots.

    It uses the same upload path as drag and drop in the web UI, which only needs pull permission.

  10. tekumara commented on Sep 13, 2026

    @tekumara

    Yep when using --attach I encounter: attaching files requires write access to the repository for repos I don't own.
    Via the UI I can add a screenshot however.
    I'm using my personal github token.

  11. 11 remaining items

  12. adehad commented on Oct 30, 2026

    @adehad

    Another case this blocks: pull requests from forks. Opening sheprd-labs/sheprd#922 from a fork, the repo's PR template asks for before/after screenshots, but gh pr create --attach stopped with attaching files requires write access to the repository before creating anything. The same happened with gh issue create --attach for the linked issue (sheprd-labs/sheprd#921). Both were opened without images, and the screenshots were dragged in through the web UI afterwards.

    On point 3: in gh 2.103.0, --help for gh pr create and gh issue create still doesn't mention the permission requirement. It's documented only in the gh agent skill (skills/gh/SKILL.md, "Attaching images and videos").

  13. Ludocius commented on Nov 10, 2026

    @Ludocius

    Same case here, from an outside reviewer (gh 2.103.0, Windows).

    I reviewed a contributor's PR on a repo where I only have read access, generated the evidence locally (test runs, generated-project builds) and tried to post the screenshots:

    $ gh pr comment 1030 -R bancolombia/scaffold-clean-architecture --body-file shots.md --attach ./01-unit-tests.png --attach ./02-generated-builds.png --attach ./03-runtime.png
    attaching files requires write access to the repository
    

    On github.com the same account can drag those images into the comment box of that PR without any extra permission. Since gh pr comment already succeeds without write access, it would help if --attach used the same rule as the web comment box: if you can comment, you can attach.

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

    blockedenhancementgh-issuegh-prplatform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions