Skip to content

Setup → Connect an Agent is admin-only, but POST /api/v1/keys mints per-user keys for anyone — the "acts as you" self-service promise cannot be kept by non-admins #16746

Description

@yinlianghui

Needs a human decision before anyone picks this up. This card describes a product-policy mismatch, not a crash. Two fixes are possible and they point in opposite directions (see Decision needed). Please do not auto-dispatch; a maintainer should choose the direction first.

Summary

The self-service page Setup → Connect an Agent (route /_console/apps/com.objectstack.setup/page/connect_agent, with the "API keys — headless … Create key" card at the bottom) is reachable only by administrators. The endpoint behind that button, POST /api/v1/keys, accepts any signed-in user and mints a key bound to the caller.

So the two halves disagree about who is allowed to connect an agent as themselves:

non-admin (sales rep / sales manager) admin
open Setup → Connect an Agent ✗ app switcher shows only the business app; /_console/apps/setup silently redirects to the app dashboard
POST /api/v1/keys (session cookie) ✓ returns an osk_… key bound to that user; MCP initialize with it → 200

Measured 2026-09-07/08 on hotcrm 789a7324 / objectstack 17.3.0, accounts na.rep@objectos.ai, sales.manager@objectos.ai, admin@objectos.ai.

Why it matters

The end-user guide that is circulating internally for this feature (two steps: "系统设置 → 连接智能体 → 创建密钥", then claude mcp add … --header "x-api-key: …") ends with the promise "Claude 只能看到和操作您自己有权限的数据" ("Claude can only see and act on data you have permission for"). The Connect-an-Agent page itself says the key "acts as you".

A non-admin following that guide stops at step 1: the page is not there. The only ways forward today are

  • an admin creates the key for them — but then the key acts as the admin, and the promise above is false for that user; or
  • the user calls POST /api/v1/keys directly (curl/script) — which works, proving the backend already intends per-user keys, but is not a path a business user can take.

Meanwhile the OAuth path, which is self-service for every user, is currently blocked by #16530 and narrowed by #16549, so in practice the API-key path is the one people reach for — and it is admin-only at the UI.

Decision needed (human)

  1. Open the page (or just the key card) to every user — consistent with the backend and with "acts as you". Then the guide is correct as written.
  2. Keep the page admin-only and also restrict POST /api/v1/keys to admins — consistent with a "keys are an admin-managed credential" policy. Then the guide must say keys are issued by an admin, and the "as yourself" promise has to be reworded, because an admin-issued key cannot act as the requesting user.

Either is defensible; leaving the UI and the API disagreeing is not. Related: #16530, #16549, objectstack-ai/hotcrm#1759.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

authbugSomething isn't workingdomain:clipriority:p1High: required for production / M2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions