---
name: ghtier-whoami
description: Show which GitHub credentials this session and this computer hold (gh logins, classic or fine-grained tokens, App tokens, GITHUB_TOKEN, tokens in a password manager), the account, the scopes or permissions, the ghtier tier where each is used, how it escalates, the risks that follow and the defenses that cut them. Starts by asking which credentials to check (all on this computer, this session only, or one token) and how far to go (read only, prove writes, or everything they reach). Use when the user asks what access this session or agent has on GitHub, which token or account is connected, what tier they are, how risky their logins or tokens are, or loads this skill. GET requests only, unless the user approves write probes built to fail.
---

# ghtier-whoami

Tells the user which GitHub credentials they hold and what each reaches, tiered with the ghtier
data (https://ghtier.com/tier), with the attack techniques each enables and the checklist items that
cut them. It starts with two or three questions, then runs what the user chose.

Everything is read-only unless the user chooses to prove writes (below). The runner sends GET
requests through `gh`. Never print, echo or ask for a token, never run `gh auth token` or a
password manager yourself, and never change a GitHub setting as part of this skill.

## 0. Get the runner

`whoami.mjs` sits next to this file. If it is not there, download it and its checksum file into a
new empty folder, read `whoami.mjs` before running it, and check it:

```bash
curl -fsSO https://ghtier.com/skills/ghtier-whoami/whoami.mjs
curl -fsSO https://ghtier.com/skills/ghtier-whoami/SHA256SUMS
grep ' whoami.mjs$' SHA256SUMS | shasum -a 256 -c
```

It needs Node 18+ and `gh`. It reads the tier data from https://ghtier.com/data. A `--data` folder
older than the runner (a checkout behind main) is replaced by the published data, with a note.

Run it as `NODE_USE_ENV_PROXY=1 node whoami.mjs ...` (in their terminal too; it changes nothing
without a proxy). Node's `fetch` ignores `HTTPS_PROXY` without it, and a sandbox that sends traffic
through a proxy (Claude Code's does) then fails with "could not fetch". The sandbox must also allow
`ghtier.com` and `api.github.com`; if it does not, tell the user they can add both to
`sandbox.network.allowedDomains` in their Claude Code settings, or answer "Yes, and don't ask
again" when Claude Code prompts for the host.

`gh` in a macOS sandbox: `gh` is written in Go, and Go checks certificates through a system service
the Seatbelt sandbox blocks, so every call fails with `x509: OSStatus -26276`. Claude Code's docs
name `sandbox.enableWeakerNetworkIsolation` for Go tools behind its proxy. Until the user has set it,
a run inside the sandbox cannot reach GitHub: say so, name the setting, and ask before running
outside, as below. Never change their settings yourself.

## 1. Ask what to check

Ask these together, in one round, with your tool for asking the user questions (in Claude Code,
AskUserQuestion). Put the recommended option first. Skip a question the user has already answered
in their request.

1. **Which credentials?**
   - **All credentials on this computer (Recommended)**: token variables, every `gh` account on
     every host, the git credential helpers, the SSH key GitHub sees, and any tokens from a password
     manager they name. Runs in their own terminal.
   - **This session only**: the credential `gh` uses here, on this repository. You run it now.
   - **One token I choose**: a token in a password manager. Runs in their own terminal.
2. **How far?**
   - **Read only (Recommended)**: GET requests only. Reads are proven; writes no GET needs stay
     "not confirmed".
   - **Read and prove writes**: adds write probes, requests built so they cannot succeed (below). It
     is no longer read-only.
   - **Everything it reaches**: every organization and repository each credential reaches
     (`--full`). Not together with write probes.
3. **Tokens in a password manager?** Ask only for "All credentials" or "One token".
   - **None**
   - **Yes**: then ask for the command that prints each token, one per token, such as
     `op read op://Vault/item/token` or `security find-generic-password -s github-token -w`.
     Ask for the command, never the token.

## 2. Run what they chose

Run from the folder the user is working in, so the runner finds the repository from the `origin`
remote. A fine-grained or App token that cannot see that repository (a password-manager token for
another one, say) is checked on a repository it can see, private first, and the report says so.

| Credentials | You do |
|---|---|
| This session | Run `node whoami.mjs --markdown --out ghtier-whoami.md` yourself, adding `--full` or the write probes as chosen. If it cannot reach GitHub from the sandbox, ask before running it outside (below). |
| All credentials | Run `node whoami.mjs --machine --markdown --out ghtier-whoami-inside.md` yourself, with one `--token-from "<command>"` per password-manager token and `--write-probes` or `--full` as chosen. Then "Inside and outside your sandbox" below. |
| One token | Give them `node whoami.mjs --token-from "<command>" --markdown --out ghtier-whoami.md` for their own terminal, with `--write-probes` or `--full` as chosen. Then read `ghtier-whoami.md`. |

### Inside and outside your sandbox

Your shell may run in a sandbox (Claude Code's does, by default) that hides credentials and blocks
network and `ssh`. Run "All credentials" there first: the report is what you, the agent, can reach
right now. Show it, then always ask, whether it found something or nothing, with one question:

- **Run it outside the sandbox**: the same command again with the sandbox off (in Claude Code,
  `dangerouslyDisableSandbox: true`), which the user approves at the prompt. The report is what an
  agent could reach if it were let out: every `gh` login's token (read with `gh auth token` and
  passed to `gh` only, never printed), token variables in their shell, and the SSH key.
- **Keep it inside**: stop here.
- **I'll run it in my terminal**: give the command in a code block without the `!` prefix, with
  `--out ghtier-whoami-outside.md`, and read the file when they say it is done.

After an outside run, write `--out ghtier-whoami-outside.md` and show it, then add one line on the
difference: each credential found outside but not inside is one the sandbox keeps from the agent,
and each found inside too is one the agent has as it runs now. Never run outside the sandbox without
that yes, and never retry a command the user declined. If you have no sandbox, the first run is
already the outside one: skip the question.

With `--token-from` in a run without a terminal to ask in, show the calls first (`--plan`), and
add `--yes` only after the user has seen them; an unlock prompt (Touch ID) still appears on their
machine for each password-manager read.

### In their own terminal

Commands for their terminal go in a code block without the `!` prefix: their shell has the
credentials yours may not, and `--machine` reads the token of every `gh` account to pass it to `gh`.
In their terminal the runner first prints every call it can make and the credentials it will read,
asks once, and only then reads the tokens, so an unlock prompt (Touch ID) comes after they have seen
the calls. It reads one token, checks it and drops it before reading the next, and the same token
found twice is checked once. The terminal shows the readable report, with each permission, tier,
technique and defense a clickable link where the terminal supports it; the file holds the linked
Markdown for you.

`--machine` also asks GitHub which account the SSH key belongs to (`ssh -T`, which can prompt to
unlock a key; `--no-ssh` skips it). With `--full`, a fine-grained or App token is probed on one
repository (it has the same permissions on every repository it reaches) and up to five
organizations (`--max-orgs`), and up to 1000 repositories are listed (`--max-repos`).

### Proving writes

For "Read and prove writes": a short list of POST, PUT and PATCH requests, each built so it cannot
succeed, such as a commit that cannot exist, a branch that does not exist, or content that is not
valid. GitHub answers 403 naming the permission when the token lacks it, and rejects the request
(422) when it has it; that order was checked live. It probes only permissions still unknown, on the
one repository each token is checked on. Show the list first (`node whoami.mjs --plan
--write-probes`) and say that it is no longer read-only. For "This session", run it with
`--write-probes --yes` once they have seen the list. If the report says a probe was accepted, stop
and tell the user: that should never happen, and they should check the repository.

## 3. Show the report as it is

The Markdown is a finished report. With more than one credential it starts with a summary table,
worst tier first. Then, for each credential: the tier at each place, every permission with how it
was proven, the escalations, the risks with real incidents, the evidence in the repository (each
item marked cut or open), the defenses and the credential itself. Every entry links to its ghtier
page, and the last line says where it came from. Do not reword tiers or drop rows.

- **Where Markdown renders** (a chat, a PR, an issue): paste it unchanged, links and last line
  included, so the user can follow each claim to its source.
- **In a terminal** (Claude Code and other CLI agents): wide tables wrap until they cannot be read.
  Show your lines below, then from the report only each credential's verdict, its "Tier where it is
  used" table and its "Evidence" section, unchanged, and give the path of the `--out` file for the
  rest.

Then add at most five lines of your own, above the report:

1. What is connected and the overall tier, in one sentence. Say "can", never "will". With several
   credentials, name the worst one and any the user may not have known about.
2. For a fine-grained or App token: GitHub does not show such a token its own permissions, so the
   report has a confirmed tier and the highest tier the role leaves possible. Name the unconfirmed
   Tier 0 and Tier 1 permissions. Never present a possible permission as held.
3. The one open item in "Evidence" that matters most, and the defense that cuts it.
4. If the task at hand needs less, the narrower credential (for example a fine-grained token for
   this repository only, with the permissions the task needs). Flag a token GitHub refused (expired
   or revoked) for deletion.
5. Anything you saw that the runner cannot. Look at your own tool list: a GitHub MCP server or
   connector is a credential the runner cannot see. Name it, and if it has a tool that returns the
   signed-in user (such as `get_me`), call it and say which account it uses.

## What the runner does and does not do

- GET requests only, through `gh`, except write probes. A token goes to `gh` in its environment
  only, never to a file or the output. `--machine` reads `gh` accounts' tokens with `gh auth token`;
  `--token-from` runs the command the user gave.
- With 1Password, Touch ID authorizes the CLI for the whole account in that terminal until it has
  been idle for 10 minutes, not for one item. The runner reads only the tokens it was given commands
  for, but cannot narrow what the unlock allows.
- Classic tokens and `gh` logins: the scopes come from GitHub's `X-OAuth-Scopes` header, so their
  reach is exact, intersected with your role at each place.
- Fine-grained and App tokens: the probes are the GET endpoints `permissions.json` lists for each
  permission. A success counts when GitHub's `X-Accepted-GitHub-Permissions` header names that
  permission (a read endpoint without the header counts, marked inferred). The header names what the
  endpoint accepts, not what the token holds, and GitHub answers 200 with data anyone may see, so a
  success counts nothing on the account's own endpoints or on a public repository. A 403 that names a
  permission means it is not held. A 404 or anything else stays unknown.
- A role that holds a permission only in part is left out of the ceiling.
- Tiers, techniques, incidents and defenses come from `permissions.json`, `scopes.json`,
  `graph.json` and `keys-policies.json`. Their SHA-256 is under `sources` in `--json` output.
  `--pin SHA256SUMS` refuses files that differ. `--show-calls` lists each call made with GitHub's
  answer, and `--plan` prints the calls and stops, with no token.
- It cannot see GitHub connections outside `gh` (MCP servers, hosted connectors), tokens stored in
  a git credential helper that are not also a `gh` account, or tokens in other programs' config
  unless the user names a command for them.

Keep what it prints in the conversation and the local file. Don't paste it into other services.
