secondsky/claude-skills / plugins/cloudflare-turnstile/skills/cloudflare-turnstile
cloudflare-turnstile
VerifiedThis skill should be used when the user asks to "add turnstile", "implement bot protection", "validate turnstile token", "fix turnstile error", "setup captcha alternative", or encounters error codes 100*/300*/600*, CSP errors, or token validation failures. Provides CAPTCHA-alternative protection for Cloudflare Workers, React, Next.js, and Hono.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 19.1 KB |
| references/advanced-topics.md | markdown | 9.1 KB |
| references/browser-support.md | markdown | 17.2 KB |
| references/common-patterns.md | markdown | 8.2 KB |
| references/error-codes.md | markdown | 12.0 KB |
| references/migration-guide.md | markdown | 18.0 KB |
| references/mobile-implementation.md | markdown | 22.7 KB |
| references/react-integration.md | markdown | 10.9 KB |
| references/setup-checklist.md | markdown | 7.4 KB |
| references/testing-guide.md | markdown | 10.3 KB |
| references/widget-configs.md | markdown | 12.6 KB |
| scripts/check-csp.shexecutable | script | 3.8 KB |
| templates/turnstile-hono-route.ts | script | 6.1 KB |
| templates/turnstile-react-component.tsx | other | 7.8 KB |
| templates/turnstile-server-validation.ts | script | 5.8 KB |
| templates/turnstile-test-config.ts | script | 7.2 KB |
| templates/turnstile-widget-explicit.ts | script | 6.5 KB |
| templates/turnstile-widget-implicit.html | other | 4.4 KB |
| templates/wrangler-turnstile-config.jsonc | other | 1017 B |
scripts/check-csp.sh
View on GitHub#!/bin/bash
#
# Turnstile CSP Checker
#
# Verifies that Content Security Policy headers allow Turnstile to function
#
# Usage:
# ./check-csp.sh https://example.com
# ./check-csp.sh https://example.com/contact
#
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if URL is provided
if [ -z "$1" ]; then
echo -e "${RED}Error: Please provide a URL${NC}"
echo "Usage: $0 <url>"
echo "Example: $0 https://example.com"
exit 1
fi
URL="$1"
echo -e "${GREEN}Checking CSP for Turnstile compatibility...${NC}"
echo "URL: $URL"
echo ""
# Fetch headers
HEADERS=$(curl -sI "$URL")
# Extract CSP header
CSP=$(echo "$HEADERS" | grep -i "content-security-policy:" | sed 's/content-security-policy: //I')
if [ -z "$CSP" ]; then
echo -e "${YELLOW}No Content-Security-Policy header found${NC}"
echo "✅ Turnstile should work (no CSP restrictions)"
exit 0
fi
echo "CSP Header found:"
echo "$CSP"
echo ""
# Initialize pass/fail counters
PASS=0
FAIL=0
# Check script-src
echo -e "${GREEN}Checking script-src...${NC}"
if echo "$CSP" | grep -q "script-src"; then
if echo "$CSP" | grep -E "script-src[^;]*https://challenges.cloudflare.com" > /dev/null; then
echo "✅ script-src allows https://challenges.cloudflare.com"
((PASS++))
elif echo "$CSP" | grep -E "script-src[^;]*\*" > /dev/null; then
echo "✅ script-src allows * (wildcard)"
((PASS++))
else
echo -e "${RED}❌ script-src does NOT allow https://challenges.cloudflare.com${NC}"
echo " Add: script-src https://challenges.cloudflare.com;"
((FAIL++))
fi
else
echo "⚠️ No script-src directive found (defaults may apply)"
fi
echo ""
# Check frame-src
echo -e "${GREEN}Checking frame-src...${NC}"
if echo "$CSP" | grep -q "frame-src"; then
if echo "$CSP" | grep -E "frame-src[^;]*https://challenges.cloudflare.com" > /dev/null; then
echo "✅ frame-src allows https://challenges.cloudflare.com"
((PASS++))
elif echo "$CSP" | grep -E "frame-src[^;]*\*" > /dev/null; then
echo "✅ frame-src allows * (wildcard)"
((PASS++))
else
echo -e "${RED}❌ frame-src does NOT allow https://challenges.cloudflare.com${NC}"
echo " Add: frame-src https://challenges.cloudflare.com;"
((FAIL++))
fi
else
echo "⚠️ No frame-src directive found (defaults may apply)"
fi
echo ""
# Check connect-src
echo -e "${GREEN}Checking connect-src...${NC}"
if echo "$CSP" | grep -q "connect-src"; then
if echo "$CSP" | grep -E "connect-src[^;]*https://challenges.cloudflare.com" > /dev/null; then
echo "✅ connect-src allows https://challenges.cloudflare.com"
((PASS++))
elif echo "$CSP" | grep -E "connect-src[^;]*\*" > /dev/null; then
echo "✅ connect-src allows * (wildcard)"
((PASS++))
else
echo -e "${RED}❌ connect-src does NOT allow https://challenges.cloudflare.com${NC}"
echo " Add: connect-src https://challenges.cloudflare.com;"
((FAIL++))
fi
else
echo "⚠️ No connect-src directive found (defaults may apply)"
fi
echo ""
# Final verdict
echo "========================================"
if [ $FAIL -eq 0 ]; then
echo -e "${GREEN}✅ CSP is compatible with Turnstile!${NC}"
exit 0
else
echo -e "${RED}❌ CSP may block Turnstile${NC}"
echo ""
echo "Recommended CSP directives:"
echo ""
echo "<meta http-equiv=\"Content-Security-Policy\" content=\""
echo " script-src 'self' https://challenges.cloudflare.com;"
echo " frame-src 'self' https://challenges.cloudflare.com;"
echo " connect-src 'self' https://challenges.cloudflare.com;"
echo "\">"
echo ""
echo "Or in HTTP header:"
echo ""
echo "Content-Security-Policy: script-src 'self' https://challenges.cloudflare.com; frame-src 'self' https://challenges.cloudflare.com; connect-src 'self' https://challenges.cloudflare.com"
echo ""
exit 1
fi
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |