Repository navigation
fix(cli): validate GitHub token responses without leaking credentials - #1004
Merged
Merged
Conversation
Cover the HTTP authentication boundary and normalize failures without preserving request credentials. Refs #467
blafourcade
marked this pull request as ready for review
October 12, 2026 10:19
blafourcade
enabled auto-merge (squash)
October 12, 2026 10:28
Merged
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.
🎯 What & why
Validate the GitHub-token HTTP boundary and return a safe authentication error when verification fails. A null response previously raised a TypeError; a rejected request preserved its original error, which could contain request credentials.
🛠️ How it works
GhTokenAdapter accepts a 2xx response with a nonblank string login. Rejected requests, malformed bodies, and non-success responses produce
AuthenticationError("GitHub API")without retaining the underlying error as a cause.Adapter tests substitute the HTTP port and use synthetic tokens. They cover success, authorization options, malformed responses, HTTP failure boundaries, and error confidentiality. No GitHub request or host CLI is invoked by these tests.
🧪 How to verify
cd cli && pnpm exec vitest run --project=unit tests/runtime/auth: 42 tests passed; the adapter has 17 cases, 11 of which failed on the original source.cd cli && pnpm test:coverage: 6,960 tests passed, one skipped, all existing thresholds passed on the currentnextbase.cd cli && pnpm exec stryker run --mutate src/runtime/auth/gh-token-adapter.ts --concurrency 2: all 39 mutants killed.Validation report.
Token-verification HTTP and network failures now use the generic authentication message instead of forwarding transport diagnostics. No coverage, mutation, or bundle threshold is changed.
🔗 Linked issue
Closes #467
✅ I certify