guardry/

guardry/Guides/Use a GitHub token

How to let an AI agent use a GitHub token without seeing it

Bind the stored token to a GitHub service for one repository and give the agent a service-only credential, so it never receives the token.

Store the GitHub token as a secret, bind it to a GitHub service for one named repository, and give the agent a service-only credential. The agent asks Guardry to perform the read and gets the result back; it never receives the token. Today this covers repository and issue reads for that one repository, and nothing else.

What the GitHub service covers

Be exact about the boundary before you set it up.

  • It covers repository reads and issue reads.
  • It covers one named repository for each service.
  • It does not cover writes.

1. Store the token

Add the token to the vault as a secret, for example GITHUB_TOKEN. Keep it a secret, not a variable, because a variable is visible to every agent credential that covers its environment.

The token's own permissions are still set at GitHub. Guardry limits what the agent can ask for, not what the token itself is able to do.

2. Bind the secret to a GitHub service

In the dashboard, bind the stored secret to a GitHub service and name the one repository it may read. The service is what the agent will be allowed to use. The secret stays where it is.

3. Create a service-only credential

Under Agent access, create an agent credential with the permission to use assigned services without ever receiving their credentials, and assign the service you made. Leave the permissions that read secret values off. Pick a lifetime: 1 hour, 4 hours, 7 days or 30 days. The credential is shown once.

# Paste the credential at the hidden prompt
guardry login --profile coding-agent

4. Request, approve, execute

# Find the ID of the assigned service
guardry services list

# Ask for approval, with a reason and a duration
guardry grants request --service SERVICE_ID --operation repository.read --purpose "Inspect the assigned repository" --minutes 5

# Check whether a person has approved or denied it
guardry grants status GRANT_ID

# Perform the read; the result comes back, the token does not
guardry services execute SERVICE_ID --grant GRANT_ID

The GitHub operation names are repository.read and issues.list. You approve or deny the request in the dashboard. The approval expires and has a use limit, so the agent asks again when it needs more.

What this does not do

  • It does not write to GitHub. The service covers reads, for one named repository.
  • It does not create short-lived GitHub credentials on demand. The stored token is the one you made at GitHub, and replacing it is manual: create a new token there and save it in the dashboard as the new value.
  • It does not protect the token from a credential that can read it. If you give any agent a read permission that covers the entry, that agent can receive the token and copy it. The dashboard shows, for every entry, which agents can reach it and how.
  • Only two services exist today: this one and TOTP one-time code generation.

Questions

Can the agent push commits or open pull requests through the service?

No. The GitHub service covers repository and issue reads for one named repository. It does not perform writes.

Does the agent ever receive the GitHub token?

No. An agent with a service-only credential asks Guardry to perform the operation and gets the result. The stored secret is not sent to it.

Can one GitHub service read several repositories?

No. A GitHub service is bound to one named repository.

What else can an agent use without seeing the credential?

One other thing today: TOTP one-time codes generated from a stored seed. See How to give an AI agent one-time codes without sharing the TOTP seed. For any other credential, the agent needs a read permission and receives the value.