fix(login): don't report GitHub as authenticated on an empty token - #179
Open
pszymkowiak wants to merge 1 commit into
Open
fix(login): don't report GitHub as authenticated on an empty token#179pszymkowiak wants to merge 1 commit into
pszymkowiak wants to merge 1 commit into
Conversation
show_status() used std::env::var("GITHUB_TOKEN").ok(), which treats a
variable that's *set but empty* as present. On K8s a Deployment often
declares GITHUB_TOKEN="" just to make the variable visible to the
container without a real value, which made `wshm login --status`
print "authenticated (env var)" for a blank token while the actual
GitHub client silently ran in anonymous mode (60 req/h).
Filters out blank values, matching the "empty-is-absent" rule already
used by inject_credentials().
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.
Summary
show_status()usedstd::env::var("GITHUB_TOKEN").ok(), which treats a variable that's set but empty as present.GITHUB_TOKEN=""just to make the variable visible to the container without a real value — this madewshm login --statusprintauthenticated (env var)for a blank token, while the actual GitHub client silently ran in anonymous mode (60 req/h).inject_credentials()already uses.Found while diagnosing why
wshm-pro's CLI subcommands couldn't see agithub_tokenthat was correctly configured in Settings → Secrets (Postgres) — see wshm-dev/wshm-pro#100 for the companion fix on the Pro side.Test plan
cargo checkcleancargo clippyclean, no warnings