Add soc login: prompt for a token and link to the page that mints one #4
No reviewers
Labels
No labels
⏳in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grey.ooo/someones.computer_agent!4
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/login-token-prompt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Before this, an unconfigured
soc deployfailed with "pass--tokenor set$SOC_TOKEN" and left the user to work out where a token even comes from. Nowthe CLI tells them, links them to the page, and stores what they paste.
What it does
soc loginprints the platform's Settings → API tokens page for the currentendpoint, offers to open it in a browser, and reads the pasted token without
echoing it (
x/termwhen stdin is a terminal; a piped stdin still works fornon-interactive use). A
deploywith no token configured runs the same promptinline instead of failing.
Token resolution order:
--token$SOC_TOKENsoc loginstoreTokens are stored per endpoint in
credentials.json—$SOC_CONFIG_HOME,else
$XDG_CONFIG_HOME/soc, else~/.config/soc— mode0600in a0700directory, written via temp-file + rename so an interrupted save can't truncate
it. Per-endpoint keying means a local stack and the hosted platform don't
overwrite each other; keys are normalised for trailing slash and case.
Verified against a real stack
Fresh config directory, no
$SOC_TOKEN, deploying:That ran against the platform's docker stack with both server-side branches
merged locally, so the whole path — prompt → store → authenticated upload → a
pendingDeployment attributed to the token's user — is proven, not just theprompt.
go vet ./...andgo test ./...pass; new coverage for the config store(round-trip,
0600mode, per-endpoint keying, corrupt file) and forlogin(prints the URL, stores what's pasted, rejects an empty token, resolution
precedence).
Depends on
adds
/settings/api-tokens— the page this links to. Merge that first, or thelink 404s.
adds the bundle-ingest endpoint the deploy above posts to.
Notes
go.modpicks upgolang.org/x/term(pinned to v0.27.0 deliberately: thecurrent release requires Go 1.25, and CI pins 1.24).
go-keyring) is still the intended upgrade; this file storeis the documented fallback and stays as the fallback when that lands.
login— there's no whoami endpoint yet, so a typosurfaces on the next deploy as a 401.
soc login: prompt for a token and link to the page that mints one