refactor(api-keys): simplify authorization to a single-role gate
Redesign tenant API key authorization around one dimension (role) plus a central default-deny gate, replacing the previous role + KB-scoped flag model. - Add APIKeyGate as the single authority for API-key authorization: routes declare one policy (MinRole) via apiKeyGroup/apiKeyRoute helpers; undeclared routes are denied by default. JWT principals short-circuit the gate and the JWT-centric RBAC guards short-circuit for API-key principals. - Roles: viewer/contributor/admin are knowledge-base data-plane only (KB scope is a pure downstream data filter); owner is a full-access tenant tier that unlocks tenant-level infrastructure routes and is required for every method. - Drop the KBScoped policy flag and the KB-restricted-vs-tenant branching. - Security hardening: never disclose HMAC secret (return presence only), abort writes on API-key encryption failure, deny KB-restricted keys on /files, and backfill legacy key hashes at startup instead of O(N) plaintext scans. - Frontend: two-level create dialog (access type -> permission level), rename role labels to reflect actual scope, sync en/zh/ko/ru locales. - Fix startup self-check false-positive on trailing-slash routes and normalize gin paths before comparison; add regression tests.
This commit is contained in:
@@ -5781,15 +5781,23 @@ export default {
|
||||
apiKeyNameRequired: "请输入 API Key 名称",
|
||||
toggleApiKeyVisible: "显示或隐藏 API Key",
|
||||
apiKeyAccessRole: "访问角色",
|
||||
apiKeyAccessRoleHint: "与空间成员角色一致,请求时按所选角色鉴权。",
|
||||
accessRoleViewer: "访客",
|
||||
accessRoleContributor: "编辑",
|
||||
accessRoleAdmin: "管理员",
|
||||
apiKeyAccessType: "访问类型",
|
||||
apiKeyAccessTypeHint: "「知识库」按下方权限级别在知识库范围内操作;「租户完全访问」额外开放模型、数据源等全部租户级接口。",
|
||||
accessTypeKnowledgeBase: "知识库",
|
||||
accessTypeTenantFull: "租户完全访问",
|
||||
apiKeyPermissionLevel: "权限级别",
|
||||
apiKeyAccessRoleHint: "前三档仅限知识库范围内操作;「租户完全访问」额外开放模型、数据源等租户级接口。",
|
||||
accessRoleViewer: "知识库只读",
|
||||
accessRoleContributor: "知识库读写",
|
||||
accessRoleAdmin: "知识库管理员",
|
||||
accessRoleOwner: "租户完全访问",
|
||||
accessRoleViewerDesc: "查询、检索和对话,不修改知识库内容。",
|
||||
accessRoleContributorDesc: "创建、更新或删除知识库内容,受知识库范围限制。",
|
||||
accessRoleAdminDesc: "管理租户级配置与集成设置;不能创建、轮换或删除 API 密钥。",
|
||||
accessRoleAdminDesc: "知识库管理,包含清空知识库等破坏性操作,受知识库范围限制;不涉及租户级配置。",
|
||||
accessRoleOwnerDesc: "完全访问,等同租户所有者:可调用模型、向量库、数据源、渠道等全部租户级接口,不受知识库范围限制。",
|
||||
apiKeyKnowledgeScope: "知识库范围",
|
||||
apiKeyKnowledgeScopePlaceholder: "留空表示允许访问全部知识库",
|
||||
apiKeyKnowledgeScopeOwnerHint: "所有者为完全访问密钥,知识库范围对其不生效。",
|
||||
allKnowledgeBases: "全部知识库",
|
||||
createdAt: "创建时间",
|
||||
actions: "操作",
|
||||
|
||||
Reference in New Issue
Block a user