fix(workspace): do not default identity providers to a live tenant - #588
Open
thereisnotime wants to merge 1 commit into
Open
fix(workspace): do not default identity providers to a live tenant#588thereisnotime wants to merge 1 commit into
thereisnotime wants to merge 1 commit into
Conversation
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.
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two identity settings ship with defaults that point at a live identity tenant:
_init_firebase()needs no service account. A project id plus Google public certs is enough forverify_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}/claimaccepts a bearer and no workspace token, and claims any workspace whosecreator_emailis unset:Afterwards
_verify_workspace_accessgrants 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_tokendoes 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_IDresolved toopenagentswebwith nothing set in the environment, andfirebase-adminwas installed and importable.Change
Both default to empty. That routes
_init_firebase()into its existing"No Firebase config, skipping init"branch, soverify_firebase_tokenreturnsNoneand 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_accessandclaim_workspaceonAUTH_MODE != "firebase"would make the documented self-host mode actually disable the hosted auth path. I did not include it because I cannot see whichAUTH_MODEthe 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.