-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
RFE: gateway.auth.tokenScopes config field for headless/single-tenant deployments #80836
Copy link
Copy link
Open
vivekchand/clawmetry
#1213Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Problem
In headless / single-tenant deployments (ours runs OpenClaw inside an ECS Fargate container, with the agent and the CLI on the same host), operator-scope upgrades require an interactive approval flow that doesn't apply to the deployment model. Each time OpenClaw tightens default scopes — most recently 2026.5.7's hardening that requires
operator.writefor cron mutations — every paired device in our fleet generates a scope-upgrade approval request and gets blocked until a human approves it via the operator UI.In our case, the requests come from devices we already trust (our own ECS containers running our own agents), but there's no way to express that trust statically in
openclaw.json. Token-auth bypasses the device-identity gate for read commands viaroleCanSkipDeviceIdentity("operator", true) = true, but mutating commands re-enter the device-identity check at a stricter scope, which the token-auth bypass doesn't cover.Today's workaround on our end was an operator UI approval after each hardening bump. That doesn't scale — every new scope OpenClaw adds in the future will recreate the same wall.
Proposed config
Add a
tokenScopesfield toGatewayAuthConfig(src/config/types.gateway.ts):Example usage in
openclaw.json:{ "gateway": { "mode": "local", "bind": "loopback", "auth": { "mode": "token", "token": "<per-boot random secret>", "tokenScopes": ["operator.admin", "operator.pairing", "operator.read", "operator.write"] } } }Semantics
auth.mode === "token"andtokenScopesis present, a successful token-auth handshake resolves to a session with exactly those scopes (not operator's default scope set).tokenScopesis absent or empty, behavior is unchanged from today (defaults apply).operator.adminshould be permissible only forbind: "loopback"(or behind an explicitallowAdminTokenScopes: trueflag) so a public-facing deployment can't accidentally grant admin to anyone with the shared token.Why this matters
Two real use cases:
operator.readonly and need scope upgrades for any non-trivial work. A config-level declaration of "this deployment is trusted to grant itself these scopes" short-circuits the bootstrap dance.Why not workarounds
identity/device-auth.jsonat boot. Requires the gateway to have already booted to generatedevice.jsonwith a deviceId — multi-stage bootstrap with race conditions, hard to make reliable.openclaw devices approvefrom inside the container. Requires admin-scoped device pairing, which is circular (that's what we're trying to avoid needing in the first place).roleCanSkipDeviceIdentitybypass. It only applies to operator role withsharedAuthOk, which is sufficient for read commands but not for cron mutations or admin-scope operations. Adding more bypass cases there fragments the logic; a clean config field is more maintainable.Environment
2026.5.7(the hardening that surfaced this for us)