Skip to content

Console API: tokens, bearer authentication with read, and whoami #1755

Closed

Description

@JacobStephens2

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 example ts_) 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, and read is 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/whoami and 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 create prints a prefixed token once. token list shows it without the secret. The token file is owner-only and holds no plaintext token.
  • An HTTP test: a read token gets a read view over 127.0.0.1, and gets 401 after token revoke and after its expiry.
  • A token sent with X-Forwarded-Proto: http is refused, and the response doesn't reveal whether the token was valid.
  • whoami returns 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.md documents creating, listing and revoking tokens, scopes, HTTPS-only, and whoami.

Activity

  1. added
    enhancement
    ready-for-agent
    on Nov 5, 2026
  2. JacobStephens2 commented on Nov 5, 2026

    @JacobStephens2
    OwnerAuthor

    Closed by #1778, merged into issue-1753 by a thirdshift Ticket run with Self-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions