Skip to content

Support downloading attachments from issues/PRs #42

Description

@drogers0

Idea

gh-image currently only handles the upload half of the attachment problem. The download half has no solution anywhere in the ecosystem: there is no way to fetch a user-attachments file from a private repo programmatically.

Since gh-image already solves the browser-session problem for uploads, it is well positioned to do the same for downloads — e.g.:

gh image download <user-attachments-url> [-o path]
gh image download --issue 42 --repo owner/repo    # pull every attachment off an issue

The session resolution order would be identical to upload (--tokenGH_SESSION_TOKEN → browser cookie), so no new credential surface is introduced.

Why this is worth doing

This is a genuine, well-documented ecosystem gap. user-attachments links on private and internal repos require a browser session — fine-grained PATs, classic PATs, OAuth apps, and GitHub App tokens all return 404:

  • cli/cli#9046 — "Download attachment/file from an issue/pr" (open)
  • github/gh-aw#21242 — "Enable agentic workflows to access issue/PR file attachments" (open; GitHub's own agentic-workflows project hitting the same wall)
  • community#162417 — "Unable to download attached file to a GitHub Issue" (answered: "These links need a browser session, so API requests won't work"; the suggested workarounds are headless Puppeteer or "don't use attachments")
  • community#54551 — "More secure private attachments - GA", the change that made this session-only in the first place

Open questions

  • Should this be gh image download, or a separate verb? Downloading isn't really "image" anymore.
  • Bulk mode: worth resolving attachments straight off an issue/PR body, or keep it URL-in / file-out?
  • Interaction with the security work in Harden SKILL.md against automated security scan findings #39 — this reads remote content, so any prompt-injection boundary guidance in SKILL.md needs to cover downloaded content too, not just uploads.

Not scheduled — filing so the idea isn't lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions