Skip to content

fix(login): don't report GitHub as authenticated on an empty token - #179

Open
pszymkowiak wants to merge 1 commit into
developfrom
fix/status-empty-github-token
Open

fix(login): don't report GitHub as authenticated on an empty token#179
pszymkowiak wants to merge 1 commit into
developfrom
fix/status-empty-github-token

Conversation

@pszymkowiak

Copy link
Copy Markdown
Collaborator

Summary

  • show_status() used std::env::var("GITHUB_TOKEN").ok(), which treats a variable that's set but empty as present.
  • On K8s, a Deployment manifest often declares GITHUB_TOKEN="" just to make the variable visible to the container without a real value — this 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 inject_credentials() already uses.

Found while diagnosing why wshm-pro's CLI subcommands couldn't see a github_token that was correctly configured in Settings → Secrets (Postgres) — see wshm-dev/wshm-pro#100 for the companion fix on the Pro side.

Test plan

  • cargo check clean
  • cargo clippy clean, no warnings

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().
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