ToolypetMCP
advanced5 minutessecurity

API Security Hardening

Harden your API with HMAC request signing, secure secrets, and SRI for client-side integrity.

apihmacsrisecrets

이 레시피 활용 시점

Protect your API from tampering and replay attacks. HMAC signing ensures requests haven't been modified, while SRI protects client-side resources from CDN compromises.

단계

1

Create a secure API key

프롬프트:Generate a 512-bit API key in base64 format
2

Sign API requests with HMAC

프롬프트:Generate HMAC-SHA256 signature for the request body using the API key
3

Ensure client-side script integrity

프롬프트:Generate SRI hash for your JavaScript bundle

자주 묻는 질문

What's the difference between HMAC and JWT for API auth?

HMAC signs individual requests (stateless per-request verification). JWT provides session-based identity. Many secure APIs use both: JWT for identity + HMAC for request integrity.

Is SRI necessary if I host my own scripts?

SRI is most valuable for third-party CDN scripts. For self-hosted scripts, it adds protection against server compromises but is less critical.

관련 레시피