Permission Scopes to Refuse in a China-Built Discord Bot

The mistake log below comes from community owners who hired a Chinese studio to build a discord bot and accepted whatever permission set the deployment walkthrough requested. Each entry records the scope that was granted, what it exposed, the refusal rule the buyer should have applied, and the contract term that keeps the scope narrow after handover. The principle is simple: a bot gets the minimum permission its documented features require, nothing inherited from the demo setup, and no power that can alter the server’s ownership structure. Rate limiting on command traffic is separate from permission scope, but both protect the server, and the audit section at the end checks both. Cross-border invoicing and account ownership do not appear in the scope list, but the same handover discipline that fixes invoicing fixes permissions: accounts in the buyer’s name, credentials rotated at delivery, and no residual access for the vendor after the final milestone.

Mistake one: granting administrator to make setup go smoothly

Record: a welcome and moderation bot was given the server-wide administrator checkbox during the initial invite, because the vendor’s deployment walkthrough showed the checkbox as the fastest way to avoid later permission prompts. Administrator bypasses every permission check and lets the bot read, alter, or remove channels, roles, members, and server settings; a leaked token with that scope is a full takeover, not a limited incident. The exposure includes changing the server name, moving categories, and deleting channels, and there is no permission-level audit that narrows down what an administrator account did.

Refusal rule: refuse the administrator checkbox for any bot that does not perform a server-administration function itself. A welcome, moderation, economy, or analytics bot needs a finite list of channel and message permissions; none needs administrator. If a vendor claims the scope is required “so future features can be added,” the answer is that future features can request their own permission changes through the server owner, not a blanket grant at launch. Contract term: the scope list is attached to the acceptance document, each permission mapped to a shipped feature, and the vendor certifies that the production invite carries no administrator role. The security review pattern for token handling and admin roles in a China-built messaging bot is set out in security review of token handling and admin roles, and the same least-privilege checklist applies to Discord role assignments.

Mistake two: letting the bot manage roles or create new roles above its own

Record: a membership sync bot was granted Manage Roles because the sync feature assigns perk roles. The scope then let the bot create or reorder any role, including roles that outranked staff, and could hand elevated permissions to a member through a flawed command. The role hierarchy in Discord means a bot can only manage roles below its own, but a misplaced high position in that hierarchy still widens the damage a bug or a stolen token can do.

Refusal rule: scope role management narrowly to the specific perk roles the sync actually touches. The bot’s own role should sit below staff moderation roles, and the role-management permission should not extend to channel-overwrite changes or role creation unless a shipped feature requires it. Refuse any permission that lets the bot edit roles held by the owner or by senior staff. Contract term: the role-sync spec lists the exact roles the bot may assign and remove, and a test case verifies that an attempt to touch a staff or owner role fails. For cross-border builds, the role list and the bot account remain under the buyer’s server ownership, so a departure of the vendor team does not leave a second controller of permissions.

Role hierarchy should also be checked visually in the server settings, not only on the invite screen. A bot that appears to hold limited permissions can still be positioned high enough in the role list to moderate members below it, including staff who joined later. Buyers should confirm the bot’s single role sits at the bottom tier next to service accounts, and that no second management role was added during setup. Any promotion of the bot’s role should require an explicit owner action, recorded in the server log, rather than happening silently during a feature update.

Mistake three: allowing webhook creation and message-posting through raw webhooks

Record: an announcement bot was granted Manage Webhooks so it could post a formatted message to a channel. A webhook URL is a standalone posting credential: anyone holding it can post as that channel without the bot token, and the vendor’s panel kept a copy in a system the buyer never inspected. The exposure is a persistent posting back door that survives a token rotation, because the webhook credential is separate from the bot account.

Refusal rule: prefer the bot’s own message permissions for announcements and refuse webhook creation unless a named third-party integration genuinely requires it. If a webhook is used, its URL belongs in the buyer’s secrets store, is documented in the runbook, and can be revoked without contacting the vendor. Contract term: the handover inventory lists every webhook created by the build, with its channel and its status, and any vendor-held webhook secret is rotated at delivery. Token and secret rotation at handover is the same discipline applied to bot tokens, hosting passwords, and provider keys, and it should appear in the runbook rather than as a verbal promise.

Mistake four: broad member-list and message-content access without a stated purpose

Record: an analytics bot requested the member-list and message-content intents during setup and kept them enabled after launch, even though its metrics used aggregates. The member intent exposes the full roster, including members who have chosen limited visibility; message-content intent reads the text of messages in channels the bot can see. Combined with a vendor-hosted database, that access becomes a record of member activity held outside the buyer’s control.

Refusal rule: enable an intent only against a documented metric or feature. A moderation bot needs message content to scan posted messages; an economy bot reading command names may not need full message history; an analytics bot working from aggregates should not hold the content intent. Member-list access should be justified by a verification or membership feature, and the retention of any roster record should follow the data rules agreed in the scope. Contract term: the acceptance document lists enabled intents and the feature each supports, and the production config confirms unused intents are disabled. The data-location expectations for bot records are covered in data residency for China-built bots, and the permission audit should match where the records those intents read actually live.

Read access also changes what the bot can surface in replies. A bot that holds message content can echo quoted messages back into a command response, which means private-channel text can leak to another channel through a poorly written answer. The spec should state whether command replies may quote source messages, and any quote should show only the reference needed for the action, not the full text. This is a smaller exposure than administrator access, but it is the kind that slips through because nobody listed the intent’s purpose during setup.

Mistake five: skipping the audit that checks rate limits and residual access

Record: after launch, the owner assumed the deployment scope matched the feature list, and nobody re-checked the live bot’s role, its intents, or the vendor’s access to the hosting account. Months later, a support contact still held operator credentials on the host, and command traffic from a bad actor was never throttled because rate limiting on command use was left as a default the vendor never tuned.

Refusal rule: run a permission audit at handover and again after any feature change. The audit reads the live invite scope, the bot’s role position, enabled intents, active webhooks, and hosting account membership. Rate limiting belongs in the same audit: per-member command windows, cooldowns, and a cap on spammy invocations, so an abuse burst does not exhaust the bot’s own platform access. Contract term: the runbook contains the audit checklist, and the buyer’s own operator runs it once in the handover session. The rate-limit design for anti-spam and command abuse is detailed in rate limits and whitelists, and the same window-and-cap model applies to Discord commands.

How scope and commercial handover align in a Chinese engagement

The permission refusal list works alongside the commercial terms of a China-sourced build. Cross-border invoicing, milestone payments, and account ownership settle who holds the bot and its secrets; the scope list settles what that holder can do. Buyers should confirm early what invoice the studio can issue, how payments tie to artifacts, and whether the bot application, hosting account, and database are transferred to the buyer’s name at the kickoff or at handover. A build that transfers accounts but keeps a broad administrator scope still leaves a takeover-sized exposure; a narrow scope but a vendor-held account still leaves a dependency. Both sides need to pass before the final milestone, and the audit checklist in the runbook is the document that proves it.

When a future feature genuinely needs a new permission, the change should go through the same review: name the feature, add the permission to the spec, update the test cases, and record the date in the server audit log. Permission creep that arrives as part of a routine update is how a minimal bot accumulates administrator-level reach over months. Keeping the scope list attached to the contract means every later expansion is a deliberate, documented decision rather than a default carried over from the first deployment walkthrough.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *