feat: integrar RBAC y allowlist de usuarios en runtime y listener

Cambios en 3 archivos:
- agents/runtime.go: construye ACL desde config de roles, verifica permisos
  antes de ejecutar comandos (command:<name>), interacción LLM (ask) y
  ejecución de tools (tool:<name>). Mensajes denegados se loguean y
  responden al usuario.
- shell/matrix/listener.go: filtra invites y mensajes de usuarios no
  autorizados cuando se configura allowed_users (allowlist vacía = todos).
- internal/config/schema.go: añade campos AllowedUsers y
  UnauthorizedResponse a FiltersCfg para soportar la allowlist en config.

Esto conecta el paquete pkg/acl con el runtime para dar soporte completo
a control de acceso por rol, sin romper la compatibilidad (ACL vacío
permite todo como antes).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 17:59:09 +00:00
parent 386e4d3dcb
commit b60782959d
3 changed files with 81 additions and 6 deletions
+8 -6
View File
@@ -209,12 +209,14 @@ type RoomsCfg struct {
}
type FiltersCfg struct {
CommandPrefix string `yaml:"command_prefix"`
MentionRespond bool `yaml:"mention_respond"`
DMRespond bool `yaml:"dm_respond"`
IgnoreBots bool `yaml:"ignore_bots"`
IgnoreUsers []string `yaml:"ignore_users"`
MinPowerLevel int `yaml:"min_power_level"`
CommandPrefix string `yaml:"command_prefix"`
MentionRespond bool `yaml:"mention_respond"`
DMRespond bool `yaml:"dm_respond"`
IgnoreBots bool `yaml:"ignore_bots"`
IgnoreUsers []string `yaml:"ignore_users"`
AllowedUsers []string `yaml:"allowed_users"` // allowlist (empty = allow all)
UnauthorizedResponse string `yaml:"unauthorized_response"` // silent (default) | explicit
MinPowerLevel int `yaml:"min_power_level"`
}
// ── Inter-agent ───────────────────────────────────────────────────────────