AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): require Discord server managers for bot setup (#13092)
### Why / What / How Why: Discord `/setup` links an entire server to an AutoGPT account, so it should only be available to users trusted to manage that server. Without this guard, any server member could initiate the link flow for the whole Discord server. What: Require Discord `Manage Server` permission for the AutoPilot bot `/setup` command and add coverage for the permission check. Also keeps the message ignore behavior explicit: the bot ignores its own messages while still allowing other bots to participate normally. How: Adds Discord command default permissions via `app_commands.default_permissions(manage_guild=True)` and a runtime permission guard in the setup handler before creating link tokens. Extracts the self-message check into a small adapter helper with tests. ### Changes 🏗️ - Require `Manage Server` permission for Discord `/setup` command registration. - Add a runtime `/setup` permission check that returns an ephemeral error before token creation. - Add tests covering non-admin setup rejection. - Make Discord self-message ignore behavior explicit and test that other bot/human messages are still accepted. ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] `cd backend && poetry run pytest backend/copilot/bot backend/platform_linking backend/api/features/platform_linking -q` - [x] `cd backend && poetry run pyright backend/copilot/bot/adapters/discord backend/util/settings.py` - [x] `cd backend && poetry run lint --skip-pyright` #### For configuration changes: - [x] `.env.default` is updated or already compatible with my changes - [x] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) No configuration changes required.
B
Bently committed
bbfdbc3ba9fcf77e7b280e5e4b07aa0baf83f124
Parent: 04ac81c
Committed by GitHub <noreply@github.com>
on 5/12/2026, 3:37:41 PM