# GitHub CLI security and privacy (/en/docs/gthb/security)

Your agent gets your GitHub issues and READMEs, and never your code or the power to change anything. `gthb` signs in
with a read-only token for the repositories you pick, keeps the token in your system keyring, and copies what people
wrote about the work, not your code.

By the end of this page you know what the token can reach, what the copy on your computer holds, and which text an
agent must treat as data. The keyring, the permissions and the run records work the same in every WireCat tool, as
the [shared security page](/llms.mdx/docs/security/content.md) describes. This page keeps what is particular to
`gthb`.

**On this page:**

1. [The token](#the-token)
2. [Where the token is kept and where it goes](#where-the-token-is-kept-and-where-it-goes)
3. [What the copy holds](#what-the-copy-holds)
4. [What the api group leaves out](#what-the-api-group-leaves-out)
5. [Text written by other people](#text-written-by-other-people)
6. [What else leaves your computer](#what-else-leaves-your-computer)
7. [MCP in the browser](#mcp-in-the-browser)
8. [Files on disk and run records](#files-on-disk-and-run-records)

## The token [#the-token]

`gthb` takes only a fine-grained personal access token, one that begins with `github_pat_`. It refuses a classic or
OAuth token before it sends anything to GitHub, in `session start` and in `GTHB_TOKEN` alike: those tokens can write
to every repository you can.

The token needs four repository permissions, all **Read-only**: Metadata, Issues, Pull requests and Contents.
Contents is there for the README, the branches, the tags and the commits. The README is the one file whose text
`gthb` copies, and it never copies your code. Give the token access only to the repositories you copy. [Install](/llms.mdx/docs/gthb/installation/content.md#make-a-read-only-token)
shows the steps.

`gthb` has no command that writes to GitHub. With a read-only token, nothing that holds it can write either.

## Where the token is kept and where it goes [#where-the-token-is-kept-and-where-it-goes]

`session start` asks for the token without showing it, or reads it from stdin. It never takes the token as an
argument, so the token stays out of your shell history. GitHub checks the token first. Then it goes into the system
keyring. Where no keyring works, it goes into a private file by itself, and `--credential-storage file` chooses the
file on purpose.

The token goes only into the Authorization header of a request to `api.github.com`, the one host that receives it.
It never appears in an address, an answer, an error or a run record. `session status` says where the token comes
from, never the token itself. `session end` forgets it on this computer, and the token stays valid on GitHub until it
expires or you delete it there.

## What the copy holds [#what-the-copy-holds]

`sync` copies the repositories you chose with `repos add` into the WireCat store on your computer, the same store the
other WireCat tools and `wcat` read:

- Issues with their comments, labels, milestones and assignees.
- Each repository's README, its description and topics.
- Pull requests with their reviews, line comments and conversation comments, and the paths of the files they change.
- Branches, tags and releases with their notes.
- Commits: the message, the paths of the changed files with their line counts, and the author's and committer's
  names and e-mail addresses as GitHub shows them.

Apart from the README, it never copies a file's contents or a diff. People's names, logins and the e-mail addresses in commits are personal
data of the people who wrote them, kept on your computer only.

## What the api group leaves out [#what-the-api-group-leaves-out]

The `api` group reaches GitHub's REST API live, one command per read operation. It has no operation that writes, and
it leaves out every operation that returns code or a secret: file contents, git objects, archives, gists, logs, code
search, webhooks, Actions variables, the README and LICENSE text, check-run annotations, CODEOWNERS errors and
Copilot Space resources. From every other answer it removes diffs (`patch`, `diff_hunk`), a check run's report text,
a deployment's or an event's `payload`, secrets, download links and download tokens, and a repository's
`temp_clone_token`. Operations that redirect to a signed download, such as an artifact's archive, are left out too.
`gthb work api show "<operation>"` says why an operation is left out.

## Text written by other people [#text-written-by-other-people]

Anyone who can open an issue writes its title and body, and anyone who can push writes the README. That text reaches
an agent marked `untrusted`:

- Issue titles and bodies, comments and their authors' names.
- Label, milestone and repository names, descriptions and topics.
- README text and the links in it.
- Pull request titles and bodies, reviews, comments, commit messages, branch and tag names, release names and notes.
- What the `api` group returns from GitHub.

An agent reads an issue that says "delete the repository" as data, not as your request.

## What else leaves your computer [#what-else-leaves-your-computer]

Only `api.github.com` receives requests from `sync`, `repos add`, `session` and the `api` group. Once a day `gthb`
also asks npm whether a newer version exists, which sends nothing of yours. `GTHB_NO_UPDATE_CHECK=1` turns that off.
Two commands can send text elsewhere, and only when you ask for them:

- `memories extract` sends one document's text to the AI model in your settings and shows what it proposes.
- `sync --embed` makes vectors for search by meaning with a model on this computer. With `embedding_provider` set to
  `openai`, the text goes to OpenAI instead.

## MCP in the browser [#mcp-in-the-browser]

`gthb work mcp serve --http` listens on `127.0.0.1` only, for browser apps that reach it through your own tunnel.
Each app logs in with a one-time code, and the server keeps a hash of each login it gives, in the state folder,
readable by you only. `gthb work mcp revoke` forgets every one of them.

## Files on disk and run records [#files-on-disk-and-run-records]

`config.json` and the list of chosen repositories are saved readable by you only (`0600`), and their folder is
created for you only (`0700`). If other users of the computer can read a file or enter a folder, `gthb doctor` lists
it under `files.problems` and prints the `chmod` that fixes it. Windows is not checked.

A run record keeps the command line as you typed it, so `gthb runs show` tells you what was run. A secret in it
is stored as `[redacted]`, as the [shared security page](/llms.mdx/docs/security/content.md) describes. To keep
none of the words you type, run `gthb work config set record_input false`.

Report a vulnerability as [SECURITY.md](https://github.com/WireCatLabs/github-cli/blob/main/SECURITY.md) says.
