Repository navigation
Closed
Labels
Description
This was generated by AI during triage.
Parent
#1753 (Spec: the Console API). Governing decision: ADR 0026.
What to build
The machine's owner issues tokens from the CLI, and a client presents one as a bearer token to use the API with the read scope.
thirdshift console token create <holder> --scopes <list> [--expires <date>]prints the token once. It is 32 random bytes with a recognizable prefix (for examplets_) so secret scanners can find it. The machine keeps only its SHA-256, with the holder, scopes, issue date, optional expiry and last use, in an owner-only file beside the Credentials. Holder names are unique on a machine. All five scope names (read,security,act,run,admin) are accepted, andreadis the default.thirdshift console token list [--json]shows holder, scopes, issue date, expiry and last use, and never the token.thirdshift console token revoke <holder>deletes the record, and it takes effect on the next request.- A bearer token is accepted only when the request reached the proxy over HTTPS (
X-Forwarded-Proto: https, which the installed Caddy and Apache configs set) or came straight to 127.0.0.1 with no proxy headers. Otherwise it is refused without being checked. - An expired or revoked token gets a 401. A token whose scopes lack the route's scope gets a 403 naming the missing scope.
/api/v1/whoamiand its CLI twin report the machine's hostname, thirdshift version, API version, and the caller's identity (token holder or session address) and effective scopes.
Token management has no API endpoint, ever (ADR 0026).
Acceptance criteria
- Through the binary:
token createprints a prefixed token once.token listshows it without the secret. The token file is owner-only and holds no plaintext token. - An HTTP test: a
readtoken gets a read view over 127.0.0.1, and gets 401 aftertoken revokeand after its expiry. - A token sent with
X-Forwarded-Proto: httpis refused, and the response doesn't reveal whether the token was valid. -
whoamireturns hostname, versions, holder and scopes. Its CLI twin passes the parity test. - Last use updates when a token authenticates a request.
- No route issues, lists or revokes tokens. A test asserts that the route table contains none.
-
docs/guide.mddocuments creating, listing and revoking tokens, scopes, HTTPS-only, andwhoami.
Activity
JacobStephens2 commentedon Nov 5, 2026
Closed by #1778, merged into issue-1753 by a thirdshift Ticket run with Self-merge.