cloudflare / cloudflare/workers-sdk

Default `wrangler login` to OS keyring storage, now that `--use-keyring` exists

Open
#15,435 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
186

Description

Title: Default `wrangler login` to OS keyring storage, now that `--use-keyring` exists

#14099 asked for OAuth tokens to stop living in plaintext at `~/.wrangler/config/default.toml`, and #14156 answered it with `wrangler login --use-keyring` (macOS Keychain, Windows Credential Manager, libsecret on Linux via `secret-tool`). That's the right mechanism. It's just off by default, so most users never turn it on and the plaintext file stays the common case.

I ran into this via a local credential scanner flagging the config file, which is what got me reading the code, but the underlying gap is real independent of that: the safer path exists and isn't the one people land on.

Request: default `wrangler login` to the keyring path when a working backend is available (macOS `security`, libsecret's `secret-tool` on Linux, `@napi-rs/keyring` on Windows), and fall back to the current plaintext TOML with a one-time warning when it isn't (headless Linux boxes with no secret service, CI, etc). `--use-keyring`/`--no-keyring` (or an env var) stay around as explicit overrides for people who want to force one path or the other.

The obvious worry with flipping the default is a bad backend probe silently pushing people to plaintext without them noticing. That already bit Linux users once: #15306 found that `secret-tool --version` exits 2 instead of 0, so wrangler's probe read a perfectly working `secret-tool` as "not installed" and fell back to plaintext. That's fixed now in #15320, but it's the kind of bug that matters a lot more once the probe is gating the default path instead of just an opt-in flag.

Contributor guide

Open the contributing guide

Research direction

Start at the Wrangler login entry point and trace the existing --use-keyring path, including backend probing and plaintext fallback. Check the secret-tool probe behavior addressed by #15320. Done means working backends are selected by default, explicit overrides remain effective, and unavailable backends produce a one-time warning before plaintext storage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.