Security Considerations
Scoped PAT lifecycle controls, human browser-verified approval for destructive actions, DNS-rebinding-pinned CIMD fetching, and transport hardening.
Scoped Personal Access Token (PAT) Lifecycle
Clients that cannot run interactive OAuth 2.1 discovery (such as DeepSeek, GLM, Cherry Studio, Cline, and Open WebUI) authenticate with Scoped Personal Access Tokens issued through https://mcp.taicket.xyz/account after Discord OAuth sign-in.
- Token Format
- tmcp_<high-entropy-secret> (opaque, non-JWT)
- Mandatory Expiry
- 7 days, 30 days, or 90 days (infinite tokens are rejected)
- Active Token Cap
- Maximum 10 active (non-revoked, unexpired) PATs per Discord user
- Plaintext Visibility
- Displayed exactly once on creation; cannot be retrieved afterward
- At-Rest Storage
- SHA-256 hex digest (tokenHash) plus tokenPrefix and tokenLast4 only
- Scoping Controls
- Per-server allowlist (specific servers or all manageable) + individual scope toggles
- Revocation
- Single-token instant revoke, Revoke All emergency button, and RFC 7009 /oauth/revoke
Least-privilege PAT defaults
Avoid granting mcp:destructive on long-lived 90-day PATs unless your workflow explicitly deletes panels or runs structural auto-setup. Even when mcp:destructive is enabled, destructive mutations still require human browser approval.
Human Browser-Verified Approval (/oauth/approve-action)
To prevent prompt injection or hallucinated AI tool loops from deleting Discord panels, removing custom commands, or creating server channels and roles without human consent, AI clients can never self-approve destructive or structural mutations.
- 1
AI generates a preview plan
Calling preview_setup or a destructive configure_* tool with mode: "preview" validates RBAC, channels, roles, and tier limits, persists an McpSetupPreview document with status: "awaiting_human_approval", a 15-minute TTL, and a SHA-256 payloadHash, and returns an approval URL: https://mcp.taicket.xyz/oauth/approve-action?id=<planId>.
- 2
Human opens the approval link in a browser
GET /oauth/approve-action?id=<planId> requires a verified mcp_account_session Discord browser cookie (redirecting through Discord OAuth if the user is not signed in). Taicket verifies session.userId === preview.userId so another Discord account cannot approve or inspect the plan.
- 3
Server owner reviews plain-language impact summary
The page renders with X-Frame-Options: DENY and displays the exact Discord server name, every destructive or structural change queued in the plan, and a single-use CSRF token.
- 4
Atomic approval binds payload hash
Clicking Approve submits POST /oauth/approve-action, verifies the CSRF token, and atomically records status: "approved", humanApprovedAt, humanApprovedBy, and approvedPayloadHash matching preview.payloadHash.
- 5
AI executes apply_setup with confirmationToken
When the AI calls apply_setup (or mode: "apply") with confirmed: true and the server-issued confirmationToken, Taicket verifies status === "approved", humanApprovedBy === ctx.userId, approvedPayloadHash === preview.payloadHash, unexpired TTL, and single-use consumption before writing to Discord or MongoDB.
{
"ok": false,
"error": {
"code": "HUMAN_APPROVAL_REQUIRED",
"message": "This change removes existing items or modifies Discord channels and roles. Open the approval link in your browser to confirm.",
"planId": "plan_8c4e1b9a2f7d4012",
"approvalUrl": "https://mcp.taicket.xyz/oauth/approve-action?id=plan_8c4e1b9a2f7d4012",
"expiresAt": "2026-12-05T14:15:00.000Z"
}
}DNS-Rebinding-Pinned CIMD & Media Fetcher
Client ID Metadata Document (CIMD) discovery and external panel media verification perform outbound server-side HTTPS requests. Naive validate-then-fetch implementations are vulnerable to DNS rebinding (TOCTOU between DNS validation and socket connect).
- Pre-flight DNS validation:: Resolves all A and AAAA records via dns.promises.lookup(hostname, { all: true }) and verifies every returned IP fails isPrivateOrReservedIp (blocking 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16 cloud metadata, 100.64.0.0/10 CGNAT, multicast, ::1, fc00::/7, fe80::/10, NAT64, and IPv4-mapped IPv6 addresses).
- Pinned socket connection:: Opens the Node https.request socket with a custom lookup callback that returns only the already-validated IP address, sets servername to the original hostname for TLS SNI certificate validation, sets the Host header, enforces rejectUnauthorized: true, disables HTTP redirects (redirect: "manual"), caps response size (32 KB JSON for CIMD, 15 MB for media), and enforces a 5-second timeout.
Encryption, Headers, and Trusted-Proxy Controls
- AES-256-GCM Discord Token Vault:: Upstream Discord OAuth tokens stored on McpOAuthGrant are encrypted at rest with MCP_TOKEN_ENCRYPTION_KEY (256-bit key) using a unique 96-bit IV and 128-bit authentication tag per record.
- Trusted-Proxy IP Handling:: Rate limiting and hashed audit IPs trust CF-Connecting-IP and X-Forwarded-For strictly when req.socket.remoteAddress is loopback (127.0.0.1, ::1, or ::ffff:127.0.0.1) behind the isolated local Nginx proxy.
- Clickjacking & Frame Defense:: All interactive authentication surfaces (/oauth/consent, /oauth/approve-action, /account) enforce X-Frame-Options: DENY, strict Content-Security-Policy frame-ancestors none, and Cache-Control: no-store.
- Tamper-Evident Audit Chain:: Every authentication grant, revocation, approval, and tool execution writes an append-only entry in taicket_mcp.mcp_audit_logs linked via prevHash -> entryHash and signed with HMAC-SHA256 (MCP_AUDIT_SIGNING_KEY).