elevenlabs-security-basics
Apply ElevenLabs security best practices for API keys, webhook HMAC validation, and voice data protection. Use when securing API keys, validating webhook signatures, or auditing ElevenLabs security configuration. Trigger: "elevenlabs security", "elevenlabs secrets", "secure elevenlabs", "elevenlabs API key security", "elevenlabs webhook signature", "elevenlabs HMAC".
Best use case
elevenlabs-security-basics is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Apply ElevenLabs security best practices for API keys, webhook HMAC validation, and voice data protection. Use when securing API keys, validating webhook signatures, or auditing ElevenLabs security configuration. Trigger: "elevenlabs security", "elevenlabs secrets", "secure elevenlabs", "elevenlabs API key security", "elevenlabs webhook signature", "elevenlabs HMAC".
Teams using elevenlabs-security-basics should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/elevenlabs-security-basics/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How elevenlabs-security-basics Compares
| Feature / Agent | elevenlabs-security-basics | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Apply ElevenLabs security best practices for API keys, webhook HMAC validation, and voice data protection. Use when securing API keys, validating webhook signatures, or auditing ElevenLabs security configuration. Trigger: "elevenlabs security", "elevenlabs secrets", "secure elevenlabs", "elevenlabs API key security", "elevenlabs webhook signature", "elevenlabs HMAC".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# ElevenLabs Security Basics
## Overview
Security best practices for ElevenLabs API key management, webhook HMAC signature verification, and protecting cloned voice data. ElevenLabs uses a single API key (`xi-api-key`) and HMAC webhook authentication.
## Prerequisites
- ElevenLabs SDK installed
- Understanding of environment variables
- Access to ElevenLabs dashboard (Settings > API Keys)
## Instructions
### Step 1: API Key Management
```bash
# .env (NEVER commit to git)
ELEVENLABS_API_KEY=sk_your_key_here
# .gitignore — MUST include these
.env
.env.local
.env.*.local
```
**Git pre-commit hook** to prevent accidental key commits:
```bash
#!/bin/bash
# .git/hooks/pre-commit
if git diff --cached | grep -qE 'sk_[a-zA-Z0-9]{20,}'; then
echo "ERROR: ElevenLabs API key detected in staged changes!"
echo "Remove the key and use environment variables instead."
exit 1
fi
```
### Step 2: Environment-Specific Keys
```typescript
// src/elevenlabs/config.ts
interface ElevenLabsSecurityConfig {
apiKey: string;
webhookSecret: string;
environment: "development" | "staging" | "production";
}
export function getSecurityConfig(): ElevenLabsSecurityConfig {
const env = (process.env.NODE_ENV || "development") as ElevenLabsSecurityConfig["environment"];
const apiKey = process.env.ELEVENLABS_API_KEY;
if (!apiKey) {
throw new Error("ELEVENLABS_API_KEY is required");
}
// Warn if production key is used in dev
if (env === "development" && apiKey.startsWith("sk_live_")) {
console.warn("WARNING: Using production API key in development environment");
}
return {
apiKey,
webhookSecret: process.env.ELEVENLABS_WEBHOOK_SECRET || "",
environment: env,
};
}
```
### Step 3: Webhook HMAC Signature Verification
ElevenLabs webhooks include an `ElevenLabs-Signature` header for HMAC verification:
```typescript
// src/elevenlabs/webhook-verify.ts
import crypto from "crypto";
/**
* Verify ElevenLabs webhook signature using HMAC-SHA256.
* The shared secret is generated when you create a webhook in the dashboard.
*/
export function verifyWebhookSignature(
payload: string | Buffer,
signatureHeader: string,
secret: string
): boolean {
if (!signatureHeader || !secret) return false;
// ElevenLabs signature format: t=<timestamp>,v1=<signature>
const parts = signatureHeader.split(",");
const timestamp = parts.find(p => p.startsWith("t="))?.slice(2);
const signature = parts.find(p => p.startsWith("v1="))?.slice(3);
if (!timestamp || !signature) return false;
// Reject timestamps older than 5 minutes (replay protection)
const age = Math.floor(Date.now() / 1000) - parseInt(timestamp);
if (age > 300) {
console.error("Webhook timestamp too old:", age, "seconds");
return false;
}
// Compute expected HMAC
const signedPayload = `${timestamp}.${payload.toString()}`;
const expected = crypto
.createHmac("sha256", secret)
.update(signedPayload)
.digest("hex");
// Timing-safe comparison to prevent timing attacks
try {
return crypto.timingSafeEqual(
Buffer.from(signature, "hex"),
Buffer.from(expected, "hex")
);
} catch {
return false;
}
}
```
### Step 4: Express Webhook Endpoint with Verification
```typescript
import express from "express";
import { verifyWebhookSignature } from "./webhook-verify";
const app = express();
// IMPORTANT: Must use raw body for signature verification
app.post("/webhooks/elevenlabs",
express.raw({ type: "application/json" }),
(req, res) => {
const signature = req.headers["elevenlabs-signature"] as string;
const secret = process.env.ELEVENLABS_WEBHOOK_SECRET!;
if (!verifyWebhookSignature(req.body, signature, secret)) {
console.error("Webhook signature verification failed");
return res.status(401).json({ error: "Invalid signature" });
}
const event = JSON.parse(req.body.toString());
// Return 200 quickly to acknowledge receipt
// Process asynchronously to avoid webhook timeout/disable
res.status(200).json({ received: true });
processWebhookAsync(event).catch(console.error);
}
);
```
### Step 5: API Key Rotation Procedure
```bash
# 1. Generate new API key in ElevenLabs dashboard
# Settings > API Keys > Create new key
# 2. Test new key before rotating
curl -s https://api.elevenlabs.io/v1/user \
-H "xi-api-key: sk_new_key_here" | jq '.subscription.tier'
# 3. Update in all environments
# Vercel:
vercel env add ELEVENLABS_API_KEY production
# Fly.io:
fly secrets set ELEVENLABS_API_KEY=sk_new_key_here
# GitHub Actions:
gh secret set ELEVENLABS_API_KEY --body "sk_new_key_here"
# 4. Deploy with new key
# 5. Verify production works
# 6. Delete old key in ElevenLabs dashboard
```
### Step 6: Voice Data Protection
```typescript
// Cloned voices contain biometric data — treat as PII
const voiceSecurityPolicy = {
// Restrict who can create/delete cloned voices
clonePermissions: "admin_only",
// Log all voice cloning operations
auditCloning: true,
// Require consent documentation before cloning
consentRequired: true,
// Auto-delete test clones after N days
testVoiceTtlDays: 30,
};
// Audit log for voice operations
function logVoiceOperation(operation: string, voiceId: string, userId: string) {
console.log(JSON.stringify({
timestamp: new Date().toISOString(),
type: "elevenlabs.voice.audit",
operation, // "clone", "delete", "use"
voiceId,
userId,
}));
}
```
## Security Checklist
- [ ] API keys in environment variables (never in source code)
- [ ] `.env` files in `.gitignore`
- [ ] Different API keys for dev/staging/prod
- [ ] Pre-commit hook scanning for key patterns (`sk_`)
- [ ] Webhook signatures verified with HMAC-SHA256
- [ ] Replay protection on webhooks (5-minute timestamp check)
- [ ] Webhook failures monitored (auto-disabled after 10 consecutive failures)
- [ ] Voice cloning operations audit-logged
- [ ] Cloned voice consent documented
- [ ] API key rotation scheduled quarterly
## Webhook Failure Policy
ElevenLabs auto-disables webhooks after:
- 10+ consecutive delivery failures, AND
- Last successful delivery was 7+ days ago (or never delivered)
Always return HTTP 200 quickly from your webhook handler.
## Error Handling
| Security Issue | Detection | Mitigation |
|----------------|-----------|------------|
| Exposed API key | Git scanning, CI check | Rotate immediately, revoke old key |
| Invalid webhook signature | `verifyWebhookSignature()` returns false | Log and reject (HTTP 401) |
| Replay attack | Timestamp > 5 minutes old | Reject with timestamp check |
| Unauthorized voice cloning | Audit logs | Restrict clone permissions |
## Resources
- [ElevenLabs Webhooks](https://elevenlabs.io/docs/overview/administration/webhooks)
- [ElevenLabs API Keys](https://elevenlabs.io/app/settings/api-keys)
- [Voice Cloning Policy](https://elevenlabs.io/safety)
## Next Steps
For production deployment, see `elevenlabs-prod-checklist`.Related Skills
checking-session-security
This skill enables Claude to check session security implementations within a codebase. It analyzes session management practices to identify potential vulnerabilities. Use this skill when a user requests to "check session security", "audit session handling", "review session implementation", or asks about "session security best practices" in their code. It helps identify issues like insecure session IDs, lack of proper session expiration, or insufficient protection against session fixation attacks. This skill leverages the session-security-checker plugin. Activates when you request "checking session security" functionality.
performing-security-testing
This skill automates security vulnerability testing. It is triggered when the user requests security assessments, penetration tests, or vulnerability scans. The skill covers OWASP Top 10 vulnerabilities, SQL injection, XSS, CSRF, authentication issues, and authorization flaws. Use this skill when the user mentions "security test", "vulnerability scan", "OWASP", "SQL injection", "XSS", "CSRF", "authentication", or "authorization" in the context of application or API testing.
performing-security-audits
This skill allows Claude to conduct comprehensive security audits of code, infrastructure, and configurations. It leverages various tools within the security-pro-pack plugin, including vulnerability scanning, compliance checking, cryptography review, and infrastructure security analysis. Use this skill when a user requests a "security audit," "vulnerability assessment," "compliance review," or any task involving identifying and mitigating security risks. It helps to ensure code and systems adhere to security best practices and compliance standards.
security-policy-generator
Security Policy Generator - Auto-activating skill for Security Advanced. Triggers on: security policy generator, security policy generator Part of the Security Advanced skill category.
finding-security-misconfigurations
This skill enables Claude to identify potential security misconfigurations in various systems and configurations. It leverages the security-misconfiguration-finder plugin to analyze infrastructure-as-code, application configurations, and system settings, pinpointing common vulnerabilities and compliance issues. Use this skill when the user asks to "find security misconfigurations", "check for security vulnerabilities in my configuration", "audit security settings", or requests a security assessment of a specific system or file. This skill will assist in identifying and remediating potential security weaknesses.
responding-to-security-incidents
Assists with security incident response, investigation, and remediation. This skill is triggered when the user requests help with incident response, mentions specific incident types (e.g., data breach, ransomware, DDoS), or uses terms like "incident response plan", "containment", "eradication", or "post-incident activity". It guides the user through the incident response lifecycle, from preparation to post-incident analysis. It is useful for classifying incidents, creating response playbooks, collecting evidence, constructing timelines, and generating remediation steps. Use this skill when needing to respond to a "security incident".
security-headers-generator
Security Headers Generator - Auto-activating skill for Security Fundamentals. Triggers on: security headers generator, security headers generator Part of the Security Fundamentals skill category.
analyzing-security-headers
This skill analyzes HTTP security headers of a given domain to identify potential vulnerabilities and misconfigurations. It provides a detailed report with a grade, score, and recommendations for improvement. Use this skill when the user asks to "analyze security headers", "check HTTP security", "scan for security vulnerabilities", or requests a "security audit" of a website. It will automatically activate when security-related keywords are used in conjunction with domain names or URLs.
security-group-generator
Security Group Generator - Auto-activating skill for AWS Skills. Triggers on: security group generator, security group generator Part of the AWS Skills skill category.
security-benchmark-runner
Security Benchmark Runner - Auto-activating skill for Security Advanced. Triggers on: security benchmark runner, security benchmark runner Part of the Security Advanced skill category.
scanning-database-security
Process use when you need to work with security and compliance. This skill provides security scanning and vulnerability detection with comprehensive guidance and automation. Trigger with phrases like "scan for vulnerabilities", "implement security controls", or "audit security".
scanning-container-security
Execute use when you need to work with security and compliance. This skill provides security scanning and vulnerability detection with comprehensive guidance and automation. Trigger with phrases like "scan for vulnerabilities", "implement security controls", or "audit security".