mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 13:34:33 +00:00
fix(agent): fail closed when user role cannot be resolved
A userId that is not a team member previously resolved to isOwner=true (role === undefined || role === 'owner'), bypassing bash restrictions. Treat only flows without a user context (autofill etc.) and explicit owner memberships as unrestricted; unknown users are now restricted.
This commit is contained in:
@@ -234,9 +234,11 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
Object.assign(skillEnvs, envs)
|
||||
}
|
||||
|
||||
// Resolve the requesting user's team role to enforce owner-only bash privileges
|
||||
// Resolve the requesting user's team role to enforce owner-only bash privileges.
|
||||
// A user who is not a member of the team is treated as restricted (fail-closed),
|
||||
// while flows without a user context (e.g. autofill) remain unrestricted.
|
||||
const role = await resolveTeamMemberRole(teamId, userId)
|
||||
const isOwner = role === undefined || role === 'owner'
|
||||
const isOwner = !userId || role === 'owner'
|
||||
const restricted = !isOwner
|
||||
|
||||
// Restore env variables from previously loaded skills in this session
|
||||
|
||||
Reference in New Issue
Block a user