Skip to content

ci(binaries): say what kind of value the token is - #67

Merged
vyncint merged 1 commit into
mainfrom
token-diagnostic
Aug 23, 2026
Merged

ci(binaries): say what kind of value the token is#67
vyncint merged 1 commit into
mainfrom
token-diagnostic

Conversation

@vyncint

@vyncint vyncint commented Aug 23, 2026

Copy link
Copy Markdown
Owner

The guard from #66 did its job — it reported that HOMEBREW_TAP_TOKEN is 55 characters and holds characters a GitHub token cannot. That rules the value out without saying what it is.

55 is a suggestive number: a fine-grained PAT is ~93 characters, a classic one is 40. It is neither.

So the check now classifies the value by its prefix, which is a published constant rather than entropy — naming which kind of token it is reveals nothing:

value reported as
github_pat_… (86) fine-grained PAT
ghp_… (40) classic PAT
ghs_… (40) a GitHub token, but not a PAT
https://github.com/settings/… (50) UNRECOGNISED — no GitHub token prefix

That last row is the shape a 55-character non-conforming value tends to have.

It also now absorbs surrounding whitespace rather than dying on it — that is the common accident and costs nothing to survive — with a warning so the secret gets repaired at source rather than on every use. The trimmed value goes through ::add-mask:: before being handed to checkout, so it is redacted in the log exactly as the original is.

Next run will name the problem outright.

The guard reported that HOMEBREW_TAP_TOKEN is 55 characters and holds
characters a GitHub token cannot, which rules the value out without
saying what it is. A fine-grained PAT is about 93 characters and a
classic one is 40, so 55 is neither.

It now classifies the value by its prefix -- a published constant rather
than entropy, so naming which kind it is reveals nothing -- and reports
the length before and after trimming. Whitespace is absorbed rather than
fatal, since that is the common accident and costs nothing to survive,
with a warning so the secret gets repaired at the source rather than on
every use. The trimmed value is registered with add-mask before being
passed on, so it is redacted in the log exactly as the original is.

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
@vyncint
vyncint merged commit 0667ffb into main Aug 23, 2026
11 checks passed
@vyncint
vyncint deleted the token-diagnostic branch August 23, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant