SecurityExecution Safety

Responsible Tool Execution

Defense-in-depth controls governing tool execution: human browser-verified destructive approval, DNS-rebinding-pinned network fetchers, ReDoS guards, and hybrid preview/apply governance.

Hybrid preview and apply governance model

Taicket MCP balances operator speed with strict blast-radius protection through a two-tier mutation model. Standard non-destructive configuration updates can run through preview_setup -> apply_setup or directly via configure_* with mode: "preview" followed by mode: "apply". Destructive or structural mutations require out-of-band human browser approval.

Mutation ClassExamplesRequired ScopeApproval Gate
Non-destructive configurationUpdating AutoMod thresholds, welcome text, SLA timers, or snippet copymcp:writemode="preview" diff review + user chat confirmation -> mode="apply" or apply_setup(confirmed: true)
Panel deploymentPosting or updating verified Components V2 panels in a validated channelmcp:deployChannel ownership + bot permission check -> deploy_discord_panel
Destructive deletionDeleting ticket panels, custom commands, component items, or reaction role panelsmcp:destructive15m McpSetupPreview + single-use confirmationToken + browser approval at /oauth/approve-action
Structural Discord auto-setupVerification or Jail auto-setup creating Discord channels, roles, and permission overwritesmcp:destructive15m McpSetupPreview + single-use confirmationToken + browser approval at /oauth/approve-action

Human browser-verified approval (/oauth/approve-action)

Prompt injection or model hallucinations can cause an AI client to supply confirmed: true or replay a confirmationToken returned in the previous tool output. To ensure an AI model can never self-approve destructive or structural operations, Taicket MCP requires an authenticated human browser action at GET and POST /oauth/approve-action?id=<planId>.

  1. 1

    Preview creates a hashed pending plan

    preview_setup or a destructive configure_* preview writes an McpSetupPreview document with requiresHumanApproval: true, status: "awaiting_human_approval", a SHA-256 payloadHash of the normalized operation payload, a single-use confirmationToken hash, and a 15-minute TTL. The tool returns planId, confirmationToken, and approvalUrl.

  2. 2

    Server manager opens the approval link in their browser

    GET /oauth/approve-action?id=<planId> requires a verified mcp_account_session cookie (redirecting through Discord OAuth if the browser is not signed in). The server verifies session.userId === preview.userId and renders a plain server-owner summary of the exact Discord server and destructive/structural operations.

  3. 3

    Human submits CSRF-protected approval

    POST /oauth/approve-action validates the per-request CSRF token and atomically transitions the preview from awaiting_human_approval to approved, recording humanApprovedAt, humanApprovedBy, and approvedPayloadHash = preview.payloadHash.

  4. 4

    Execution verifies cryptographic payload binding

    When the AI client calls apply_setup (or destructive configure_* apply), the server confirms mcp:destructive scope, valid single-use confirmationToken, status === "approved", humanApprovedBy === ctx.userId, and approvedPayloadHash === preview.payloadHash, then atomically marks consumedAt so the plan cannot be replayed.

    HUMAN_APPROVAL_REQUIRED response when browser approval is pendingjson
    {
      "ok": false,
      "error": {
        "code": "HUMAN_APPROVAL_REQUIRED",
        "message": "This change removes existing items or creates server channels and roles. Open the approval link in your browser to confirm before applying.",
        "planId": "plan_01JXYZA1B2C3D4E5",
        "approvalUrl": "https://mcp.taicket.xyz/oauth/approve-action?id=plan_01JXYZA1B2C3D4E5",
        "expiresAt": "2026-06-15T14:40:00.000Z"
      }
    }

DNS-rebinding-pinned CIMD and external media fetcher

Both OAuth CIMD metadata discovery and external image/banner verification for panels and greetings perform outbound HTTPS fetches. Naive validate-then-fetch implementations are vulnerable to DNS rebinding (TOCTOU) where a hostile DNS record returns a public IP on validation and 169.254.169.254 or 127.0.0.1 on the actual socket connect.

mcp/src/security/validation.ts eliminates DNS rebinding by resolving the hostname exactly once via dns.promises.lookup(hostname, { all: true }), verifying every returned IPv4 and IPv6 address against isPrivateOrReservedIp, and passing a custom lookup function to Node https.request that yields only the validated IP while preserving TLS SNI (servername: hostname) and certificate verification (rejectUnauthorized: true).

Pinned-IP HTTPS request preventing DNS rebindingtypescript
import dns from 'node:dns/promises';
import https from 'node:https';
import type { LookupAddress } from 'node:dns';

export async function pinnedHttpsGet(rawUrl: string, maxBytes: number): Promise<Buffer> {
  const target = new URL(rawUrl);
  if (target.protocol !== 'https:') {
    throw new Error('Only HTTPS URLs are permitted.');
  }

  const records: LookupAddress[] = await dns.lookup(target.hostname, { all: true });
  if (records.length === 0 || records.some((r) => isPrivateOrReservedIp(r.address))) {
    throw new Error('Destination resolves to a blocked or private IP range.');
  }

  const pinned = records[0];
  return new Promise<Buffer>((resolve, reject) => {
    const req = https.request(
      {
        hostname: target.hostname,
        port: target.port ? Number(target.port) : 443,
        path: target.pathname + target.search,
        method: 'GET',
        servername: target.hostname,
        rejectUnauthorized: true,
        timeout: 5000,
        headers: { Host: target.host, 'User-Agent': 'Taicket-MCP/1.0' },
        lookup: (_host, _opts, cb) => cb(null, pinned.address, pinned.family),
      },
      (res) => {
        if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400) {
          req.destroy();
          reject(new Error('Redirects are disabled for outbound fetches.'));
          return;
        }
        const chunks: Buffer[] = [];
        let total = 0;
        res.on('data', (chunk: Buffer) => {
          total += chunk.length;
          if (total > maxBytes) {
            req.destroy();
            reject(new Error('Response exceeded maximum allowed size.'));
            return;
          }
          chunks.push(chunk);
        });
        res.on('end', () => resolve(Buffer.concat(chunks)));
      }
    );
    req.on('timeout', () => req.destroy(new Error('Outbound request timed out.')));
    req.on('error', reject);
    req.end();
  });
}
CIMD metadata cap
32 KB JSON maximum, 5-second timeout, redirects disabled
External media cap
15 MB maximum, 5-second timeout, redirects disabled, magic-byte image header validation
Blocked ranges
127.0.0.0/8, ::1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, 100.64.0.0/10, fc00::/7, fe80::/10, multicast

ReDoS protection, field RBAC, and trusted-proxy checks

  • ReDoS guard (isSafeRegexPattern):: Custom regex filters supplied to configure_automod, configure_autoban, or reaction triggers are validated against nested quantifiers, catastrophic backtracking patterns, and maximum length caps before persistence.
  • Field-level RBAC on every write and read:: Even authorized guild managers cannot overwrite protected fields outside their privilege tier (for example, Temp Admins writing Server Settings or interviewers altering InterviewConfig).
  • Trusted-proxy IP attribution:: Rate limiting and audit IP hashing evaluate the validated Cloudflare edge client IP only from loopback Nginx connections, preventing bypass via forged headers.

Related documentation