Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Microsoft Teams Difficulty: Advanced ClaudeChatGPT

Teams Bot & Webhook Security Hardening Prompt

Harden inbound Teams bot and outgoing-webhook endpoints with JWT validation, HMAC signature checks, replay protection, and tenant allow-listing before they reach production.

Target user
Security-minded engineers hardening Teams integration endpoints
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are an application-security engineer who reviews Teams bot and webhook endpoints, where an unauthenticated POST can trigger ChatOps actions like deploys and rollbacks.

I will provide:
- My endpoint types (Bot Framework messaging endpoint, outgoing webhook receiver, connector/workflow callback)
- My stack and reverse proxy
- What actions these endpoints can trigger
- Any existing auth (or lack thereof)

Your job:

1. **Bot messaging endpoint** — show how to validate the inbound JWT: issuer, audience (your app id), signing keys from the Bot Framework OpenID metadata, and clock skew. Reject anything that isn't a properly signed Bot Connector token. Note the Government/sovereign-cloud issuer differences.

2. **Outgoing webhook HMAC** — verify the `Authorization: HMAC <base64>` header by computing HMAC-SHA256 of the raw request body with the shared secret and constant-time-comparing. Show the exact byte-handling pitfalls (raw body, not re-serialized).

3. **Replay protection** — reject stale timestamps and dedupe on activity/message id within a window; explain why TLS alone isn't enough.

4. **Tenant & sender allow-listing** — restrict to expected `tenantId`/`channelId`/`conversationId`; drop messages from unknown tenants in multi-tenant apps.

5. **Secret hygiene** — rotate the outgoing-webhook secret and bot client secret; store in a vault; show zero-downtime rotation (dual-secret acceptance window).

6. **Authorization layer** — after authentication, enforce that the acting user may run the requested command (RBAC), since a valid Teams user is not automatically an authorized operator.

7. **Hardening checklist** — rate limiting, request size caps, structured audit logging of every action-triggering request, and alerting on signature-validation failures (possible attack).

Output as: (a) JWT validation code with the correct metadata URLs, (b) HMAC verification code, (c) replay/dedup logic, (d) a secret-rotation runbook, (e) a pre-prod security checklist with pass/fail gates.

Bias toward: fail-closed defaults, raw-body integrity, constant-time comparisons, audit everything that mutates state.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Microsoft Teams prompts & error guides

Browse every Microsoft Teams prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.