Commit 343afb2
authored
docs: add SECURITY.md (#26)
* docs: add SECURITY.md pointing at private vulnerability reporting
gh-attach handles GitHub authentication cookies on the local machine
and uploads file contents under the signed-in user's identity via
the Git Data API. A bug in the wrong place could expose credentials
or let an attacker write content under someone else's auth, so the
project needs a documented private reporting path before that
becomes a problem.
Private Vulnerability Reporting is already enabled on the repository
(confirmed via `gh api /repos/.../private-vulnerability-reporting`
returning `enabled: true`), so the policy points reporters at
`/security/advisories/new` as the primary channel. No separate
email backup — GitHub's private advisory workflow is the single
canonical path and avoids the "email bitrot" problem of stale
inbox addresses in security policies.
## Contents
- **Supported versions**: latest tagged release only. Pragmatic for a
pre-1.0 project with frequent releases; contributors are expected
to `gh extension upgrade` before filing a report.
- **Reporting flow**: explicit "no public issues" warning, link to
the private advisory form, and a checklist of useful info to
include (version, platform, repro, affected code paths, proposed
fix, credit preference).
- **Response expectations**: realistic small-team numbers — 5 days
to acknowledge, 10 days to triage, severity-dependent fix window,
30–90 day coordinated-disclosure window.
- **Scope**: explicit list of in-scope areas that map to real
attack surface in this codebase:
- cookie extraction + jar handling
- the 3-step upload token chain
- file-handling paths (--name validation, stdin temp files,
filepath.Base assumptions, symlink handling, path traversal
in both upload and get)
- ref handling (gh.ValidateKey, get's tree walking)
- git remote URL parsing (potential for argument injection in
the downstream gh CLI calls)
- output rendering (markdown injection, JSON contract)
- **Out of scope**: upstream `gh`, `kooky`, Go stdlib, GitHub itself,
and intended-behavior uploads by authenticated users. Pointed at
upstream repos for the report.
- **Disclosure**: coordinated disclosure with reporter credit by
default (anonymity on request).
Intentionally narrow — this is a ~1500-LOC CLI, not an enterprise
framework, and a 100-line policy is plenty. No CVE numbering, no
bug bounty, no PGP key — those add process without adding safety
for a project this size.
* docs: fix SECURITY.md to describe gh-attach's actual auth + upload flow
Address PR #26 review: the original SECURITY.md listed an attack
surface that doesn't exist in this project. I conflated gh-attach
with the other gh-image project (drogers0/gh-image), which DOES use
kooky for browser cookie extraction and the 3-step
uploadToken/asset_upload_authenticity_token/S3 browser protocol.
gh-attach's actual mechanism is different:
1. `gh auth token` (via execCommand) → OAuth token from the gh CLI
2. JSON POST to api.github.com/.../git/blobs|trees|commits|refs
with `Authorization: token <OAUTH>` header
3. No browser cookies, no kooky dependency, no S3 presigned POST,
no asset_upload_authenticity_token chain
Verified against the actual source before rewriting:
- ghAuthToken exec path: internal/gh/resolver.go:65-66 uses
execCommand("gh", "auth", "token")
- Authorization header: 8 call sites across gitdata.go and
comment.go, all using "token <OAUTH>"
- 4-step upload (blob → tree → commit → ref):
gitdata.go:171,195,212,222/230
- 4-step download (ref → commit → tree → blob):
gitdata.go:532,546,562 with docstring at 496-499
- go.mod has zero external dependencies — no kooky, no cookie
handling code exists at all
## Corrections
- Intro paragraph: "handles GitHub authentication cookies on the
local machine" → describes the gh auth token exec path instead.
- Scope / Authentication handling: rewritten to cover the real
attack surface (token resolution, Authorization header handling,
token leakage into logs/errors/JSON output).
- Scope / new "gh CLI delegation" bullet: enumerates the three
actual execCommand call sites and flags `gh pr view --repo <repo>`
as the only one where user-influenced input reaches argv.
- Scope / new "Git Data API flow" bullet: describes the real 4-step
upload sequence and the matching 4-step download sequence in
GetAttachments, plus DeleteRef and ListRefs.
- Scope / File handling: added specific mentions of expandFiles
symlink handling and the get pre-flight conflict check.
- Scope / Ref handling: made "commit/tree walking" explicitly
belong to `gh attach get`.
- Scope / Output rendering: pointed at FormatSection and EmbedURL
by name instead of describing them abstractly.
- Out of scope: removed the kooky line entirely (not a dependency);
added a clarifying note on gh CLI token storage so reporters know
local-storage bugs belong in cli/cli, not here.
No other sections touched.1 parent 7b45fec commit 343afb2
1 file changed
Lines changed: 123 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
0 commit comments