Repository navigation
fix(cli): send GitHub PAT in POST body, not the URL query string - #159
Merged
Merged
Conversation
GetNullifyToken exchanged the GitHub PAT for a Nullify token via
GET /auth/github_token?token=…, putting the secret in the URL where it leaks
into access logs and proxies. Send {owner, token} as a JSON POST body instead.
Requires the backend POST support (nullify monorepo auth/ PR #5485) to be
deployed first; the backend keeps GET for older CLIs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
Author
|
Status check (2026-05-28): still relevant, still blocked. CLI side: Backend side: monorepo PR #5485 ( Recommend: leave in draft, ping when #5485 is merged and rolled out. |
tim-thacker-nullify
marked this pull request as ready for review
June 19, 2026 06:35
scrut-nick
pushed a commit
to scrut-nick/nullify-cli
that referenced
this pull request
Aug 28, 2026
Our transport had no 401 handling at all. It refreshed on a five-minute TTL and, when the provider failed, fell back to the stale cached token - so against a credential revoked mid-life every single request failed, forever, with no attempt to fetch a replacement. That is the shape of the outage we just spent a week diagnosing. This ports the behaviour of upstream Nullify-Platform#165 onto our simpler transport rather than adopting the file wholesale, because this fork branched at Nullify-Platform#138 and the upstream version depends on Nullify-Platform#151/Nullify-Platform#158 that we do not carry. - refreshProvider is a second, distinct provider used only after a 401. tokenProvider returns the stored token untouched while it still looks valid, so reusing it for the retry would replay the rejected string - the exact bug Nullify-Platform#165 was written to fix. - auth.ForceRefreshToken refreshes regardless of the recorded expiry, and reports ErrNotRefreshable when the credentials carry no refresh token. - lib.RefreshNullifyToken reports client.ErrTokenNotRefreshable for sources that yield a fixed string (--nullify-token, NULLIFY_TOKEN), so the transport surfaces the 401 instead of retrying something that cannot change. - Separate backoff clocks for the TTL and 401 paths: one provider failing says nothing about the other, and without them a rejected credential puts a blocking refresh in front of every request. - A refresh that returns nothing, or returns the token just rejected, leaves the cache alone rather than overwriting a working value with junk. - Request bodies are buffered so a retried POST carries its payload. Tested: retry-and-succeed, fixed-source surfaces the 401, same-token and empty returns do not loop or clobber the cache, body replay, backoff suppression, concurrent rotation, non-401 passthrough, and provider-failure backoff. Upstream's own note on Nullify-Platform#165 was that this code went broken from February to August precisely because it had no tests. CLAUDE.md records what remains unported, including Nullify-Platform#159 - the GitHub PAT is still sent in a URL query string. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mcq6LfAVPzKZL5rpvww13R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The GitHub-Actions token exchange (
internal/lib/get_token.go) sent the GitHub PAT in the URL query string (/auth/github_token?token=…), where it leaks into access logs, proxies, and request-logging middleware. The code carried a standingTODO(security).What
Send
{owner, token}as a JSON POST body to/auth/github_tokenwithContent-Type: application/json. No other behavior changes.Rollout ordering⚠️
This is the client half of a coordinated change. The backend POST support is nullify monorepo PR #5485 (
feat(auth): accept GitHub token via POST body). That must merge and deploy before this CLI change ships, otherwise the CLI would POST to a GET-only endpoint. Both are drafts until then; the backend keeps GET for already-released CLIs.Test plan
go build ./...,go vet ./internal/lib/...,go test ./internal/lib/...pass.🤖 Generated with Claude Code