Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Secure Figma API tokens, configure scopes, and validate webhook signatures. Use when securing API keys, implementing least-privilege scopes, or auditing Figma security configuration. Trigger with phrases like "figma security", "figma secrets", "secure figma token", "figma scopes", "figma webhook verify".
.claude/skills/jeremylongshore-figma-security-basics/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 22% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 22% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 68% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 31% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 19% | 0% |
Secure your Figma API integration: store tokens safely, apply least-privilege scopes, rotate credentials, and verify webhook signatures.
.gitignore configured for secret filesbash# .env (NEVER commit) FIGMA_PAT="figd_your-personal-access-token" FIGMA_OAUTH_CLIENT_SECRET="your-oauth-secret" # .gitignore .env .env.local .env.*.local *.pem
typescript// Validate token exists before any API call function getToken(): string { const token = process.env.FIGMA_PAT; if (!token) throw new Error('FIGMA_PAT is not set'); if (!token.startsWith('figd_')) { console.warn('Token does not have expected figd_ prefix'); } return token; }
Assign the minimum scopes needed for each use case:
| Use Case | Required Scopes | |----------|----------------| | Read file structure | file_content:read | | Export images | file_content:read | | Post comments | file_comments:write | | Read variables (Enterprise) | file_variables:read | | Manage webhooks | webhooks:write | | Read team components | team_library_content:read | | Dev mode resources | file_dev_resources:read |
Deprecated scope: files:read is deprecated. Use specific scopes like file_content:read, file_comments:read instead.
bash# PATs have a maximum 90-day lifetime # Schedule rotation before expiry # 1. Generate new token in Figma Settings > Personal access tokens # 2. Test new token curl -s -H "X-Figma-Token: ${NEW_TOKEN}" \ https://api.figma.com/v1/me | jq '.handle' # 3. Update environment # For CI: gh secret set FIGMA_PAT --body "${NEW_TOKEN}" # For production: update your secret manager # 4. Verify old token is revoked in Figma Settings
Figma webhooks use a passcode field (not HMAC signatures) for verification:
typescript// When creating a webhook, you provide a passcode: // POST /v2/webhooks // { "event_type": "FILE_UPDATE", "team_id": "...", "endpoint": "...", "passcode": "my-secret" } // Figma sends the passcode back in the webhook payload body interface FigmaWebhookPayload { event_type: string; passcode: string; // Your secret, echoed back timestamp: string; file_key?: string; file_name?: string; webhook_id: string; } function verifyFigmaWebhook( payload: FigmaWebhookPayload, expectedPasscode: string ): boolean { // Timing-safe comparison to prevent timing attacks if (payload.passcode.length !== expectedPasscode.length) return false; const a = Buffer.from(payload.passcode); const b = Buffer.from(expectedPasscode); return crypto.timingSafeEqual(a, b); } // Express handler app.post('/webhooks/figma', express.json(), (req, res) => { const payload: FigmaWebhookPayload = req.body; if (!verifyFigmaWebhook(payload, process.env.FIGMA_WEBHOOK_PASSCODE!)) { console.warn('Invalid webhook passcode'); return res.status(401).json({ error: 'Invalid passcode' }); } // Process the event handleFigmaEvent(payload); res.status(200).json({ received: true }); });
markdown- [ ] PAT stored in environment variable, not in code - [ ] `.env` files listed in `.gitignore` - [ ] Token uses minimum required scopes - [ ] Token rotation scheduled before 90-day expiry - [ ] Webhook passcode verified on every incoming request - [ ] OAuth client secret stored in secret manager (not repo) - [ ] No tokens in frontend/client-side code - [ ] Git history scanned for leaked tokens (use `git log -p | grep figd_`) - [ ] Different tokens for dev/staging/prod environments
| Security Issue | Detection | Mitigation | |----------------|-----------|------------| | Token in git history | git log -p \| grep figd_ | Revoke immediately, rotate, use BFG Repo Cleaner | | Expired PAT | 403 errors in production | Set calendar reminder for 80-day mark | | Over-scoped token | Audit in Figma Settings | Regenerate with minimum scopes | | Webhook spoofing | Missing passcode check | Always verify passcode before processing |
Verify a token is valid and see who it acts as, without exposing it in shell history (Step 1 storage + /v1/me probe):
bashFIGMA_PAT=$(security find-generic-password -s figma-pat -w 2>/dev/null || pass show figma/pat) curl -s -H "X-Figma-Token: ${FIGMA_PAT}" https://api.figma.com/v1/me | jq '{id, email, handle}'
Reject a forged webhook delivery (Step 4 passcode verification):
bashcurl -s -X POST localhost:3000/figma/webhook \ -H 'Content-Type: application/json' \ -d '{"event_type":"FILE_UPDATE","passcode":"wrong"}' # 401 {"error":"invalid passcode"}
Rotation runbook and the full checklist: references/token-rotation.md, references/security-checklist.md.
For production deployment, see figma-prod-checklist.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 14,849 | 23,877 | +61% | 1 | 1 | 0% | 2,981 | 4,692 | +57% | 0 | 0 | — |
case-02 | fail→pass | 15,899 | 9,460 | -40% | 1 | 1 | 0% | 2,738 | 3,336 | +22% | 0 | 0 | — |
case-03 | fail→pass | 24,207 | 13,877 | -43% | 1 | 1 | 0% | 3,435 | 4,187 | +22% | 0 | 0 | — |
case-04 | fail→pass | 10,884 | 10,712 | -2% | 1 | 1 | 0% | 2,147 | 3,608 | +68% | 0 | 0 | — |
case-05 | pass→pass | 17,049 | 15,547 | -9% | 1 | 1 | 0% | 2,650 | 4,497 | +70% | 0 | 0 | — |
case-06 | pass→pass | 15,913 | 20,227 | +27% | 1 | 1 | 0% | 3,209 | 5,023 | +57% | 0 | 0 | — |
case-07 | pass→pass | 9,277 | 4,161 | -55% | 1 | 1 | 0% | 1,552 | 2,239 | +44% | 0 | 0 | — |
case-08 | pass→pass | 6,759 | 3,943 | -42% | 1 | 1 | 0% | 1,164 | 2,174 | +87% | 0 | 0 | — |
case-09 | pass→pass | 12,123 | 8,410 | -31% | 1 | 1 | 0% | 2,297 | 3,210 | +40% | 0 | 0 | — |
case-10 | pass→pass | 10,052 | 8,209 | -18% | 1 | 1 | 0% | 1,977 | 3,106 | +57% | 0 | 0 | — |
case-11 | fail→fail | 12,791 | 13,124 | +3% | 1 | 1 | 0% | 2,007 | 3,622 | +80% | 0 | 0 | — |
case-12 | fail→pass | 743,058 | 6,766 | -99% | 1 | 1 | 0% | 1,976 | 2,584 | +31% | 0 | 0 | — |
case-13 | pass→pass | 5,451 | 3,055 | -44% | 1 | 1 | 0% | 1,017 | 2,136 | +110% | 0 | 0 | — |
case-14 | fail→fail | 10,787 | 7,078 | -34% | 1 | 1 | 0% | 1,883 | 2,742 | +46% | 0 | 0 | — |
case-15 | pass→pass | 10,908 | 6,795 | -38% | 1 | 1 | 0% | 1,996 | 2,734 | +37% | 0 | 0 | — |
case-16 | pass→pass | 14,555 | 11,421 | -22% | 1 | 1 | 0% | 2,146 | 3,636 | +69% | 0 | 0 | — |
case-17 | pass→pass | 8,152 | 9,253 | +14% | 1 | 1 | 0% | 1,540 | 3,457 | +124% | 0 | 0 | — |
case-18 | pass→pass | 5,543 | 2,657 | -52% | 1 | 1 | 0% | 835 | 1,957 | +134% | 0 | 0 | — |
case-19 | fail→pass | 19,955 | 14,220 | -29% | 1 | 1 | 0% | 3,224 | 3,824 | +19% | 0 | 0 | — |
case-20 | pass→pass | 11,681 | 10,974 | -6% | 1 | 1 | 0% | 2,401 | 3,625 | +51% | 0 | 0 | — |
case-21 | fail→pass | 15,379 | 12,309 | -20% | 1 | 1 | 0% | 2,891 | 3,852 | +33% | 0 | 0 | — |
case-22 | pass→pass | 8,235 | 7,234 | -12% | 1 | 1 | 0% | 1,570 | 2,676 | +70% | 0 | 0 | — |
case-23 | pass→pass | 17,391 | 18,314 | +5% | 1 | 1 | 0% | 2,706 | 4,871 | +80% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +26 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.