Skip to content

fix(workspace): do not default identity providers to a live tenant - #588

Open
thereisnotime wants to merge 1 commit into
openagents-org:developfrom
thereisnotime:fix/identity-defaults
Open

fix(workspace): do not default identity providers to a live tenant#588
thereisnotime wants to merge 1 commit into
openagents-org:developfrom
thereisnotime:fix/identity-defaults

Conversation

@thereisnotime

Copy link
Copy Markdown

Two identity settings ship with defaults that point at a live identity tenant:

FIREBASE_PROJECT_ID: str = os.environ.get("FIREBASE_PROJECT_ID", "openagentsweb")
APPLE_CLIENT_IDS:  str = os.environ.get("APPLE_CLIENT_IDS", "org.openagents.workspace")

_init_firebase() needs no service account. A project id plus Google public certs is enough for verify_id_token, so any deployment that does not override these will verify identity tokens issued by that tenant.

Why it matters for self-hosted instances

POST /v1/workspaces/{id}/claim accepts a bearer and no workspace token, and claims any workspace whose creator_email is unset:

if workspace.creator_email and workspace.creator_email != email:
    return json_response(ResponseCode.FORBIDDEN, "Workspace already claimed by another user")
workspace.creator_email = email

Afterwards _verify_workspace_access grants that email full access to the workspace with no workspace token at all.

So on a default self-hosted deployment, a holder of an account on the tenant named above can claim any unclaimed workspace on that instance. AUTH_MODE=workspace_token does not gate either path. The workspace id is a slug that appears in URLs rather than a secret.

Confirmed on a self-hosted instance running the current develop: config.FIREBASE_PROJECT_ID resolved to openagentsweb with nothing set in the environment, and firebase-admin was installed and importable.

Change

Both default to empty. That routes _init_firebase() into its existing "No Firebase config, skipping init" branch, so verify_firebase_token returns None and the bearer paths fail closed. Deployments that use these providers set them in the environment.

Note this flips the default for the hosted deployment too, so it will need the values set explicitly if it was relying on them.

A stronger fix, left to maintainers

Gating the bearer branch in _verify_workspace_access and claim_workspace on AUTH_MODE != "firebase" would make the documented self-host mode actually disable the hosted auth path. I did not include it because I cannot see which AUTH_MODE the hosted deployment runs with, and getting that wrong would break login there.

Testing

tests/test_identity_defaults.py: both defaults empty, still configurable via env, and verification fails closed with no project set.

Full backend suite before and after: the same 20 pre-existing failures and 544 passes, plus the 4 added here.

FIREBASE_PROJECT_ID defaulted to openagentsweb and APPLE_CLIENT_IDS to
org.openagents.workspace. _init_firebase() needs no service account, a project
id plus Google's public certs is enough to verify tokens, so any deployment
that does not override these verifies identity tokens minted by that tenant.

For a self-hosted instance that means trusting an identity provider its
operator does not control. POST /v1/workspaces/{id}/claim takes a bearer and no
workspace token, and claims any workspace whose creator_email is unset. After
that _verify_workspace_access grants that email full access with no workspace
token at all. AUTH_MODE=workspace_token does not gate either path. The
workspace id is a slug that appears in URLs rather than a secret.

Both now default to empty, which sends _init_firebase() down its existing
'No Firebase config, skipping init' branch so verification returns None.
Deployments that use these providers set them in the environment.

Tests assert both defaults are empty, that they remain configurable, and that
verification fails closed when no project is set.

Ran the backend suite before and after: same 20 pre-existing failures, 544
passing, plus the 4 added here.
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

@thereisnotime is attempting to deploy a commit to the Raphael's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant