Skip to content

Commit ee806d8

Browse files
idoubiclaude
andcommitted
fix(security): deny admin access on IM channels without admins config
Previously, when admins[channel] was not configured for an IM channel (wechat, telegram, etc.), isAdminChatter returned true for ALL chatters, allowing any anonymous user to modify SOUL.md, IDENTITY.md and other identity files via write_file/edit_file tools. Now falls back to ownership check (chatter UserID == agent ownerUserID) instead of granting blanket admin. Operators can still explicitly grant admin to specific platform IDs via admins[channel] in agent.json. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9d673c1 commit ee806d8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

internal/agent/slash.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,12 @@ func (a *Agent) isAdminChatter(msg bus.InboundMessage) bool {
174174
}
175175
list, ok := a.admins[msg.Channel]
176176
if !ok || len(list) == 0 {
177-
// No allowlist configured for this channel → preserve legacy
178-
// unrestricted behavior. Operators opt in to group-chat
179-
// protection by populating admins[channel].
180-
return true
177+
// No allowlist configured for this channel. Fall back to
178+
// ownership check: if the IM chatter's resolved FastClaw
179+
// user_id matches the agent owner, they're admin. Otherwise
180+
// deny — an unconfigured allowlist should NOT grant admin
181+
// to every anonymous chatter on a public-facing IM channel.
182+
return msg.UserID != "" && msg.UserID == a.ownerUserID
181183
}
182184
for _, id := range list {
183185
if id == msg.UserID {

0 commit comments

Comments
 (0)