fix(security): harden agent share listing and align full-access API key routes
Enforce tenant ownership in ListSharesByAgent so full-access API keys cannot enumerate cross-tenant shares, and allow full-access keys to create KBs and manage share routes consistently with other tenant-wide operations.
This commit is contained in:
@@ -172,7 +172,7 @@ type KBShareRepository interface {
|
||||
type AgentShareService interface {
|
||||
ShareAgent(ctx context.Context, agentID string, orgID string, userID string, tenantID uint64, permission types.OrgMemberRole) (*types.AgentShare, error)
|
||||
RemoveShare(ctx context.Context, shareID string, userID string, tenantID uint64) error
|
||||
ListSharesByAgent(ctx context.Context, agentID string) ([]*types.AgentShare, error)
|
||||
ListSharesByAgent(ctx context.Context, agentID string, tenantID uint64) ([]*types.AgentShare, error)
|
||||
ListSharesByOrganization(ctx context.Context, orgID string) ([]*types.AgentShare, error)
|
||||
ListSharedAgents(ctx context.Context, tenantID uint64, callerTenantRole types.TenantRole) ([]*types.SharedAgentInfo, error)
|
||||
ListSharedAgentsInOrganization(ctx context.Context, orgID string, tenantID uint64, callerTenantRole types.TenantRole) ([]*types.OrganizationSharedAgentItem, error)
|
||||
|
||||
@@ -103,8 +103,9 @@ const (
|
||||
APIKeyCapabilityManageMembers APIKeyCapability = "manage_members"
|
||||
// APIKeyCapabilityManageSpaces lets a key manage organization/space
|
||||
// collaboration surfaces such as space membership and join flows. It does
|
||||
// not grant KB/agent share management, which still depends on resource
|
||||
// ownership and remains JWT-only/default-deny for API keys.
|
||||
// not grant KB/agent share management: share management is reserved for
|
||||
// full-access keys (and JWT) and scoped keys stay default-deny. This
|
||||
// capability never lifts it.
|
||||
APIKeyCapabilityManageSpaces APIKeyCapability = "manage_spaces"
|
||||
// APIKeyCapabilityManageTenantSettings lets a key read and update
|
||||
// tenant-scoped integration settings exposed under /tenants, such as API
|
||||
|
||||
Reference in New Issue
Block a user