Skip to content

doctor secrets

Terminal window
holocron doctor secrets [--env <list>] [--only-secrets | --only-variables] [--strict] [--name <name>] [--verify] [--shared [--allow NAME]... [--ignore-allowed]]

Compares the secret names the config says must exist with the names the secrets provider holds, and prints one row for each scope that has something expected: the repository, the organization and each environment. It changes nothing, shows no value (GitHub never returns one), and exits non-zero while any row fails.

A workflow that reads a secret which does not exist fails quietly, and a secret is quick to forget when a repo is set up by hand. This is the check that says which are missing. To see everything that does exist, use list secrets.

✓ repository secrets exist 2 of 2 exist
✗ organization secrets exist 2 problem(s)
- missing secret HOLOCRON_NOTIFY_WEBHOOK_SYNC
- missing secret NPM_TOKEN
1 ok, 1 fail, 0 skipped

These replace doctor credentials. They read names only: the credentials providers are loaded without being asked for a value, and each lists the variable names of an Environment (Credentials.inspect). A name counts as present when <org/repo> - local or - dev holds it, as a machine reads them. The provider also says which names are visible (1Password’s concealed flag), and those are in the Variables block, not the Secrets one: dev is expected to hold its own copy of each variable repo.variables.sync writes to GitHub (nothing falls back from ci), and local expects none. A required Environment that does not exist is a failing row, by name; a token a plugin needs that neither holds is a failing row (missing from ...); a token a plugin only falls back to (optional, such as HOLOCRON_RELEASE_TOKEN or the Discord webhook) is a skipped row. The rest is one ok row per provider that says how many tokens are present and which spelling of the Environment’s name matched. A provider that cannot list names, a config with no environment, or no plugin that lists tokens is a skipped row that says so. With no credentials provider the two columns are left out, unless you ask for them with --env local or --env dev, when one skipped row says so.

The default output is a matrix: one row per name, one column per place that can store it. Names only; no value, hash or length is ever printed. The columns come from the config and are grouped by what stores them: the vault (1Password), GitHub (repository, organization and environment secrets, and variables) and the deployments repo.secrets.deploy feeds. There are two blocks, Secrets and then Variables, each with a heading, so a visible value is never mistaken for a concealed one.

Secrets
name 1Password ci 1Password prod GitHub repo Deploy prod
TOKEN_A ok n/a ok ?
TOKEN_B ok n/a MISSING ?
APP_ONE n/a ok n/a ?
Legend
ok present where it should be
n/a not needed here
MISSING needed here, not found
extra found here, but nothing feeds it
? could not read this place
3 names: 4 ok, 1 MISSING, 0 extra, 3 not read

The last line counts what the table shows: the distinct names, then the cells that are ok, MISSING or extra, and not read for the ? cells when there are any (n/a is not counted). A check that failed in the rows above it is added at the end (; 1 check failed). The exit status comes from the rows, as before. A run with no table (nothing was read) ends with the count of rows instead, as in the first example above.

The cells are words, not symbols or colour, so a pipe or a log reads the same, and the legend is always printed. To keep the table narrow a place that is n/a for every name is left out as a column, and a name that is n/a in every place is left out as a row; one closing line under the block says how many, and --name <name> still says how each place stands for a name that was left out. When the table still passes the width of the terminal the column headings are shortened (1Password is 1P, GitHub is GH, and a GitHub environment is headed by its name alone) and a Headings list under the legend defines each one:

Secrets
name 1P dev 1P ci 1P prod GH repo GH org sentinel-production sentinel-preview
TOKEN_A ok ok n/a ok n/a MISSING n/a
APP_ONE n/a n/a ok n/a n/a ok ok
(left out, n/a everywhere: 2 names and 1 place (1Password local); --name <name> says how each place stands)
Legend
ok present where it should be
...
Headings
1P 1Password
GH GitHub
sentinel-production GitHub environment sentinel-production
sentinel-preview GitHub environment sentinel-preview

When even that is too wide, each name is shown as a short list instead, with the full headings.

  • Needed comes from the config: repo.secrets.sync (its keys, scope), repo.secrets.deploy, repo.secrets.repo, org and environments, repo.variables and repo.variables.sync, and the notification layout. The Environment a sync entry or a deploy entry names is a 1Password column. A name in the prod or preview Environment is also fed when the repo.secrets.deploy entry of any workspace package for that layer lists it (keys or prefix, as sync secrets reads it): those configs are read only when one of the two layers is checked, and a package whose config cannot be read is a skipped row naming it.

  • MISSING is a failure. Where another row already reports a GitHub name, the matrix adds none; a 1Password name that an entry lists and the Environment lacks fails in its own row.

  • extra is advisory: it is in the table and makes no row, and the exit is 0. --strict makes each place that has some a failing row. A vault Environment can feed both kinds (this repo’s ci does) and the table’s ci columns cannot tell a secret from a variable, so each block counts only its own kind: a name the variable entries list is never an extra secret, and a name neither kind lists is reported once, under Secrets. An organization holds secrets for other repositories too, so for an organization only the names this config feeds are shown. A secret you set by hand on purpose goes in doctor.manualSecrets (names only, beside doctor.sharedVariables) and is never reported:

    doctor: { manualSecrets: ["HOLOCRON_LIGHTHOUSE_TOKEN"] },
  • ? is a place that could not be read (no provider, a missing or refused token, an Environment not found). It is a skipped row that names the place and why, never a failure, and the other places are still compared. A deployment is always ?: the project or Worker is named when you run sync secrets (--project-id, --worker), not in the config.

--only-secrets and --only-variables show one block and read only that side; with neither, both are shown.

holocron doctor secrets --name TOKEN_A prints one line for each place that holds or needs the name, and why, for example GitHub repo (secrets): MISSING, synced to repository secrets by entry 1 of repo.secrets.sync (from acme/demo - ci). It is informational and exits 0. A name is matched without regard to case. This and the extra cells replace doctor variable-owners: with the layers, the same name legitimately lives in dev, ci and GitHub, so “held by two places” is the normal case, and what is worth reporting is a place that holds a name nothing feeds.

--verify also asks each vendor whether the tokens the configured plugins take are still accepted. It is opt-in because it goes online (slower, and subject to the vendors’ rate limits); the default stays offline. This replaces doctor tokens. For every token a plugin lists, the token is looked up the way the plugin does it (the process environment, then the repo’s .env and the credentials providers, then the OS keyring) and the plugin’s verifyToken is asked. Each verify:<token> row says where the token came from; a token is never printed. A token that is not set is a skipped row, since whether it is needed depends on what is run. One that is set and rejected (expired, revoked, malformed) fails, and so does one that expires in 7 days or fewer. A credentials provider that could not be read fails its own row, because its tokens would then fall through to the keyring. What a token may do is not checked: GitHub does not return a fine-grained token’s permissions.

The scheduled check-tokens workflow runs holocron doctor secrets --verify daily, so a token that is rejected or about to expire reaches the team before an operation breaks. The run installs the 1Password CLI and signs in with HOLOCRON_OP_SERVICE_ACCOUNT_TOKEN, a read-only service account for the ci Environment, so the 1password rows and the Vault ci column are read like any other run; the token reaches only the step that runs holocron. The run passes --env ci, because that service account sees only the ci Environment: without the flag it would ask for local and dev too and report them missing. Without the token the 1password rows fail and the job is red every day.

--shared compares the layers named by --env (two or more of local, dev, ci, prod, preview and agent; all six when there is no --env) for a secret that holds the same value in two of them. Each layer of a repository keeps its own values, so a leak from CI does not expose what a laptop holds, and a token made for an agent or a preview instance is never a copy of one held elsewhere. Only a concealed value is compared: a plain value (an account id, a dataset name) is a constant and is left out, and a name shared on purpose is listed in doctor.sharedVariables or passed with --allow, and is left out between the layers that hold it, except for the agent layer: an allowed name is still reported when the agent layer holds another layer’s value, because an agent’s tokens are never copies. holocron doctor secrets --shared --strict is the check that no token in 1Password is shared across layers. It changes nothing and prints names only: no value, hash or length reaches the output, a log or an error. It is opt-in because it reads the values of the Environments, in memory; the default never reads a value. This replaces doctor secrets.

· ci = dev info: 2 secrets share a value between dev and ci: HOLOCRON_ADMIN_TOKEN, HOLOCRON_SYNC_TOKEN
✓ prod = dev no secret shares a value
✓ prod = ci no secret shares a value
3 pairs compared, 2 shared names, 0 variables drifting
Rule Detail
Only secrets An entry the vault holds concealed. A visible variable is meant to be the same in every layer and is ignored. The 1Password plugin reads the flag from op environment secret list --format=json
No fallback The credentials chain falls back from local to dev. This check reads each layer by its own name
Salted hash Each value becomes an HMAC under a salt made fresh for the run and is compared only in memory. A hash from one run means nothing in another. An empty value is ignored
Same value, any name A value held under two names counts and is shown as LATER_NAME = EARLIER_NAME

A vault provider that cannot say which entries are concealed (it has readEnvironment only) has every entry compared, and a skipped row says so.

One shared:pair:<later>:<earlier> row per pair of layers, in local, dev, ci, prod, preview, agent order. A pair that shares no secret is ok. A pair that shares one or more is an info row (shown as skipped); with --strict it is a failure and the exit is 1. A layer whose Environment could not be read is a skipped row that names it and why (a missing local, preview or agent is silent). With fewer than two readable layers, or fewer than two named in --env, one skipped row says there is nothing to compare.

When ci and dev are both compared, the visible (unconcealed) entries of the two are compared by name too, because the organization’s constants live in ci and have a copy in dev. A variable that ci has and dev lacks, and one whose value differs, are info rows, since a dev value may differ on purpose. --strict does not apply to them.

A name that two layers hold on purpose (one bot identity) is left out when it is listed in doctor.sharedVariables in holocron.config.ts or passed with --allow NAME (repeat for more). Names are compared without regard to case, and for a value held under two names, allowing either is enough.

Terminal window
holocron doctor secrets --shared --env ci,dev,prod --strict --allow HOLOCRON_DISCORD_BOT_TOKEN

--ignore-allowed audits without the allow list: every secret that two layers share is reported, and each name that doctor.sharedVariables or --allow would have excused is marked (allowed). Use it to check that a name on the list is still shared on purpose, with no edit to the config.

Terminal window
holocron doctor secrets --shared --ignore-allowed

It needs a vault provider that can read an environment (1password) and an origin remote that names the repository, which gives the Environment names.

The Actions variables of repo.variables are checked here too, in the Variables block and in the rows below it: one row for the repository’s variables and one for the organization’s, each only when the config declares that scope, and one per repo.variables.sync entry (the values are in the vault, so only names are compared). A variable that exists but is not declared is a problem only with repo.variables.prune; without it, it is an extra name in the matrix. (This replaces the old doctor variables command.)

--env takes a list of local, dev, ci, test, prod, preview and agent, comma-separated or repeated: --env ci,prod and --env ci --env prod are the same. A name that is not one of them is an error that lists the seven. Duplicates count once, and the rows come out in the order local, dev, ci, test, prod, preview, agent whatever order you typed.

Environment What it compares
ci The GitHub side (secrets and variables) and the vault Environments that feed it: the names the config expects (below), the repo.secrets.sync entries and who can read the organization secrets
prod The deploy-<environment> rows for repo.secrets.deploy (below)
local The tokens the configured plugins take (their tokens export) against <org/repo> - local, then - dev: a machine reads the first it finds. A missing - local is not mentioned
dev The same tokens against <org/repo> - dev
test Has no layer: tests use fakes and read none. A skipped row says so
preview Compared with the other layers by --shared only; a skipped row says so when it is named without it
agent The same: compared by --shared (an agent’s tokens are never copies of another layer’s), and checked by holocron doctor agent

With no --env, local, dev, ci and prod all run; test appears only when you ask for it. With --env, only the ones you name run, so --env prod reads no GitHub secret and --env test reads nothing.

holocron doctor secrets --env test
· test environment test: has no layer (tests use fakes and read none)

Nothing is expected beyond these, and a secret that exists but is not expected is never a problem, since many legitimate ones are not listed anywhere.

Scope Expected
Repository repo.secrets.repo, and the Chromatic token of each project of a test:visual task: CHROMATIC_PROJECT_TOKEN for tokenName: "default" (or none), otherwise CHROMATIC_PROJECT_TOKEN_<TOKENNAME>
Organization repo.secrets.org, and the secrets the notification layout fills: each channel’s webhook secret (webhook.secret, else HOLOCRON_NOTIFY_WEBHOOK_<CHANNEL>) and each role’s secret. The organization is --org, HOLOCRON_ORG, the config’s org, or the repo’s owner
Environment repo.secrets.environments.<name>

Declare the rest in holocron.config.ts. Names only, never values; new secret and sync secrets write them.

repo: {
secrets: {
repo: ["TURBO_TOKEN", "VERCEL_TOKEN"],
org: ["NPM_TOKEN"],
environments: { production: ["DATABASE_URL"] },
},
},

Names are compared without regard to case, as GitHub does. Fragments from presets add up: each list is a union.

holocron sync secrets --env <environment> pushes the keys of a vault environment into GitHub secrets. Declare which keys go where in repo.secrets.sync: the sync follows it (see sync secrets) and the doctor expects those names too:

repo: {
secrets: {
sync: [
{ environment: "prd" }, // every key the vault holds, as repository secrets
{ environment: "ci", keys: ["AXIOM_TOKEN"], scope: "org=theholocron" }, // one key, as an organization secret
],
},
},
Field Meaning
environment The vault environment id, as given to sync secrets
keys The --github-secret allowlist. Leave it out for every key the environment holds; the doctor then asks the vault for them
scope repo (the default), env=<name> or org=<name>, as --github-secret-scope words it
repos org= only, required there: the repositories that can read the secrets (visibility selected)

The names join the scope’s own row (an org= other than the organization above gets its own row). Only key names are kept: the vault provider returns an environment as KEY=VALUE pairs, and the doctor drops the values at once, never logging or printing them. An entry with keys needs no vault at all. Entries merge across presets by environment and scope; if any fragment leaves keys out, that entry stays “every key”.

For each organization with a repo.secrets.sync entry that has repos (#2062), an org-secret-access row (org-secret-access-<org> for another organization) reads who can read each synced secret, by name, and compares it with the entry. It fails for a secret readable by more repositories than its entry says (visibility all or private, or selected with a repository the entry does not list) and for one missing a listed repository. When all match it says how many secrets sit at each list:

✓ theholocron organization secrets are readable only by their entries' repositories 9 selected [.github, holocron]; 5 selected [holocron]
✗ no organization secret is overridden by a repository secret of the same name 1 problem(s)
- HOLOCRON_ORG_TOKEN exists at repository and organization level: the repository secret overrides it

The secrets a notification layout fills (HOLOCRON_NOTIFY_*) are compared the same way with the layout’s readers (#2131), in the same row; a layout with no readers declares nothing here, and setup notifications refuses to write them. A secret that does not exist is the “exist” row’s finding. The org-secret-shadowed row fails for a name that exists at both levels, because the repository secret wins and keeps the old value after a rotation. Both rows are skipped, with the reason, when the provider cannot report it or the token cannot read it. Only names and repository names are read.

A row is a skip, not a failure, when it cannot be read: no secrets provider is configured or it could not load, or the provider has no token for that scope. When nothing is expected anywhere, the one row says none declared.

Each Environment in repo.secrets.deploy (what sync secrets may send to a deployment or Worker) gets a deploy-<environment> row that lists the key names it would send and the ones it keeps back, read from the vault in memory. It does not fail; it makes a token that should not go out visible before the sync. A vault that cannot list the Environment makes it a skipped row.

An entry of repo.secrets.sync without keys is its own skipped row (sync-<environment>), with the reason, when there is no vault provider, it has no token, or it cannot list that environment. The rest of the check is unaffected. repo.variables.sync (Actions variables, not secrets) is separate and is checked by doctor secrets. An entry whose scope is not repo, env=<name> or org=<name> fails.

A row fails when a secret is missing, when there is an organization secret to look for but no organization to look under, and when the provider reports an error for that scope (for example an environment that does not exist).

Reads use the same tokens as list secrets: github.secrets for the organization scope, github.admin for the repository and environments.

doctor notifications keeps its own step for the layout’s secrets, so a problem there shows in both.

sync secrets takes the same word as --env, but exactly one, because it writes: holocron sync secrets --env ci.

Related: doctor, doctor secrets, list secrets.