Skip to content

feat: add --service-token auth and /api/workspaces/status endpoint#228

Closed
bzlo wants to merge 1 commit intoBackblaze:mainfrom
bzlo:feat/service-token-and-workspace-status
Closed

feat: add --service-token auth and /api/workspaces/status endpoint#228
bzlo wants to merge 1 commit intoBackblaze:mainfrom
bzlo:feat/service-token-and-workspace-status

Conversation

@bzlo
Copy link
Copy Markdown
Contributor

@bzlo bzlo commented Mar 14, 2026

Summary

  • Adds --service-token / BOARDWALKD_SERVICE_TOKEN CLI option for static machine-to-machine API authentication (no expiry, no browser login)
  • Service token requests authenticate as service@boardwalk and bypass the user-state lookup in prepare()
  • Adds GET /api/workspaces/status authenticated endpoint returning workspace names, details, semaphores, and last-seen timestamps
  • Fixes a latent bug: self.request.headers["boardwalk-api-token"] raised KeyError (500) when the header was absent; changed to .get() which returns None and lets Tornado's auth flow return 403

Changes

src/boardwalkd/cli.py

  • New --service-token click option (env var: BOARDWALKD_SERVICE_TOKEN)
  • Passed through serve() -> run() -> make_app()

src/boardwalkd/server.py

  • APIBaseHandler.get_current_user(): checks boardwalk-api-token header against the configured service token first; sets _is_service_auth flag; falls back to existing secure-cookie path
  • APIBaseHandler.prepare(): skips user-state lookup when _is_service_auth is True
  • New WorkspacesStatusApiHandler class for GET /api/workspaces/status
  • make_app() and run() accept and propagate service_token

Test plan

  • Full test suite passes (pytest -- 33 passed)
  • ruff check clean
  • ruff format --check clean
  • semgrep clean (0 findings)

Made with Cursor

Adds a static service token mechanism for machine-to-machine API access
without browser-based login or token expiry. When --service-token (or
BOARDWALKD_SERVICE_TOKEN env var) is set, requests bearing that value in
the boardwalk-api-token header authenticate as service@boardwalk.

Also adds GET /api/workspaces/status, a read-only endpoint that returns
all workspace names, details, semaphores, and last-seen timestamps for
monitoring integrations.

Made-with: Cursor
@bzlo bzlo requested a review from asullivan-blze as a code owner March 14, 2026 04:43
@asullivan-blze
Copy link
Copy Markdown
Contributor

Superseded by #229. (Was the simplest method, since I don't know if there's a corresponding push in gh.)

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.

2 participants