gh-attach reads the signed-in user's OAuth token from the gh CLI
(via gh auth token) and uses it to push file contents under that user's
identity via GitHub's Git Data API. A security bug in this tool could leak
the token, let an attacker write content under someone else's identity, or
escape out of the intended filesystem boundaries on upload or download, so
please report issues privately so they can be fixed before public disclosure.
Only the latest tagged release receives security fixes. The project is pre-1.0 and releases often β please upgrade before reporting:
gh extension upgrade gh-attachIf you can only reproduce the issue on an older version, mention that in the report, but the fix will ship on the latest release line.
Do not open a public issue for security problems. Public issues are indexable and broadcast the vulnerability before a fix is available.
Use GitHub's Private Vulnerability Reporting:
Private Vulnerability Reporting is enabled on this repository. The report is visible only to you and the maintainers; GitHub handles the advisory workflow and credit tracking. Please include as much of the following as you can:
- A description of the issue and its impact
- Reproduction steps, including the installed version (
gh extension listshows the gh-attach version) and your platform - Any proof-of-concept code, scripts, or sample output
- Affected code paths or commits, if you've found them
- A proposed fix if you have one
- Your GitHub handle if you'd like public credit after the fix ships
This is a small-team open-source project. Realistic targets:
| Event | Timeline |
|---|---|
| Initial acknowledgment | within 5 business days of your report |
| Triage and severity assessment | within 10 business days |
| Fix development | depends on severity and complexity |
| Coordinated disclosure | typically 30β90 days after a fix ships, sooner if actively exploited |
If you have not heard back within the acknowledgment window, please nudge via the security advisory thread.
Anything in the gh-attach binary or its upload/download flow. High-value
areas to probe:
- Authentication handling β the
gh auth tokenexec path ininternal/gh/resolver.gothat resolves the user's OAuth token, how that token is passed to the HTTP client (Authorization: token ...on every request ininternal/gh/gitdata.goandinternal/gh/comment.go), and whether the token can leak into error messages, log output, or the--jsonresult on stderr/stdout. ghCLI delegation β the three subprocess call sites thatgh-attachgoes through (all ininternal/gh/resolver.go):git remote get-url origin(static args),gh auth token(static args), andgh pr view --json number --repo <repo>where<repo>is the string passed to--repoor parsed from the git remote. The third one is the only path where user-influenced input reaches argv, so it's the candidate worth probing for argument-injection edge cases.- Git Data API flow β the 4-step upload sequence (blob β tree β
commit β ref create or fast-forward) in
internal/gh/gitdata.go, the matching 4-step download sequence (ref β commit β tree β blob) inGetAttachments, and the ref create/delete endpoints inDeleteRef/ListRefs. - File handling β
--namebasename validation, stdin materialization to temp files, path traversal in both the upload andgetpaths,filepath.Baseassumptions on arbitrary input, symlink handling inexpandFiles, and the pre-flight conflict check + force-overwrite behavior ofgh attach get. - Ref handling β
refs/uploads/*namespace construction, ref name validation (gh.ValidateKey), and the commit/tree walking performed bygh attach get. - Git remote parsing β the SSH and HTTPS URL parsers in
internal/gh/repo.go, including any input that could lead to command or argument injection in theghCLI calls that follow, or to targeting the wrong repository. - Output rendering β markdown injection via filename fields in
FormatSection, URL encoding in embed URLs (EmbedURL), and the--jsonoutput contract forupload/list/getresults.
Please report the following upstream rather than here β they are not
gh-attach vulnerabilities:
- Issues in the
ghCLI itself, including how it stores and retrieves OAuth tokens on the local machine - Issues in the Go standard library, toolchain, or
net/httpdefaults - Issues in GitHub's own API, storage infrastructure, or rate limits
- An authenticated user uploading content to their own repositories β that is the intended behavior of the tool
We practice coordinated disclosure:
- You report the vulnerability privately via the link above.
- We acknowledge, triage, and develop a fix.
- We release a patched version on a new tag.
- After a mutually agreed delay, we publish the security advisory, credit the reporter (unless anonymity is requested), and link to the fix commit and release.
Reporters are credited in the advisory and in the release notes for the fix unless they prefer to remain anonymous.