Skip to content

docs: Clarify HTTP endpoint auth is optional, not required#4562

Merged
bfops merged 11 commits intomasterfrom
bot/docs-http-auth-optional
Mar 6, 2026
Merged

docs: Clarify HTTP endpoint auth is optional, not required#4562
bfops merged 11 commits intomasterfrom
bot/docs-http-auth-optional

Conversation

@clockwork-labs-bot
Copy link
Collaborator

Summary

All /v1/database routes go through anon_auth_middleware, which allocates a new anonymous identity when no Authorization header is provided. The docs previously marked many endpoints as requiring auth (Required Headers) when they actually accept anonymous requests.

Code audit

Traced through anon_auth_middleware in crates/client-api/src/auth.rs and each route handler in crates/client-api/src/routes/database.rs:

Route Old docs Actual behavior New docs
POST /v1/database (publish) Required Optional (anon creates new DB) Optional + explanation
PUT /v1/database/:id (publish) Required Optional (ownership checked) Optional + explanation
GET /v1/database/:id (info) No auth section No auth used Unchanged
DELETE /v1/database/:id Required Optional (ownership checked) Optional + explanation
GET .../names No auth section No auth used Unchanged
POST .../names Required Optional (TLD ownership checked) Optional + explanation
PUT .../names Required Optional (ownership checked) Optional + explanation
GET .../identity No auth section No auth used Unchanged
GET .../subscribe (WS) Optional Optional Unchanged (already correct)
POST .../call/:reducer Required Optional (identity passed to reducer) Optional + explanation
GET .../schema No auth section No permission check Added Optional section
GET .../logs Required Optional (ownership checked) Optional + explanation
POST .../sql Required Optional (RLS enforces access) Optional + explanation

Routes that genuinely require auth (POST /v1/identity/websocket-token, GET /v1/identity/:id/verify) use SpacetimeAuthRequired and are unchanged.

Changes

  • authorization.md: Added paragraph explaining anonymous access for all /v1/database endpoints
  • database.md: Changed Required Headers to Optional Headers for 8 endpoints, with per-endpoint explanations of anonymous behavior
  • database.md: Added new Optional Headers section to /schema endpoint (previously undocumented)

All /v1/database routes go through anon_auth_middleware, which
allocates a new anonymous identity when no Authorization header is
provided. The docs previously marked many of these as 'Required'
when they actually accept anonymous requests.

Changes:
- authorization.md: Add paragraph explaining anonymous access for
  all /v1/database endpoints
- database.md: Change 'Required Headers' to 'Optional Headers' for
  publish, delete, names, call, logs, and sql endpoints
- database.md: Add 'Optional Headers' section to schema endpoint
  (previously had no auth documentation at all)
- Each endpoint now explains what happens without auth: anonymous
  identity allocated, public-only access, ownership checks still
  enforced for privileged operations

Routes that genuinely require auth (identity/websocket-token,
identity/verify) are unchanged -- they use SpacetimeAuthRequired
which returns 401 when no token is provided.
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
bfops and others added 5 commits March 5, 2026 10:33
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
POST /v1/identity/:identity/set-email is documented but not
implemented — no route exists in identity.rs. Remove it.

The remaining 'Required Headers' in identity.md are websocket-token
and verify, both of which use SpacetimeAuthRequired and genuinely
require auth. The only 'Required Headers' in database.md is the
WebSocket protocol headers for /subscribe (not auth-related).
@clockwork-labs-bot clockwork-labs-bot added this pull request to the merge queue Mar 5, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 5, 2026
@bfops bfops added this pull request to the merge queue Mar 6, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 6, 2026
@bfops bfops added this pull request to the merge queue Mar 6, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 6, 2026
@bfops bfops enabled auto-merge March 6, 2026 04:09
Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bfops bfops added this pull request to the merge queue Mar 6, 2026
Merged via the queue into master with commit 21b5af0 Mar 6, 2026
33 of 35 checks passed
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.

3 participants