implementing-api-key-security-controls

Featured

Implements secure API key generation, storage, rotation, and revocation controls to protect API authentication credentials from leakage, brute force, and abuse. The engineer designs API key formats with sufficient entropy, implements secure hashing for storage, enforces per-key scoping and rate limiting, monitors for leaked keys in public repositories, and builds key rotation workflows. Activates for requests involving API key management, API key security, key rotation policy, or API credential protection.

AI & Automation 13,115 stars 1533 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Implementing API Key Security Controls ## When to Use - Designing secure API key generation with sufficient entropy and identifiable prefixes for leak detection - Implementing server-side API key hashing (never storing keys in plaintext) with SHA-256 or bcrypt - Building key rotation workflows that allow zero-downtime key replacement for API consumers - Configuring per-key scoping to limit each API key to specific endpoints, IP ranges, and rate limits - Setting up automated monitoring for API key leakage in GitHub repos, logs, and client-side code **Do not use** API keys as the sole authentication mechanism for user-facing applications. API keys are best suited for server-to-server communication and developer access. ## Prerequisites - Secure random number generator (os.urandom, secrets module) for key generation - Database with proper encryption at rest for storing hashed API keys - Redis or similar store for key-to-metadata caching and rate limiting - Secret scanning tools (GitHub secret scanning, truffleHog, gitleaks) - Monitoring and alerting infrastructure for key usage anomalies ## Workflow ### Step 1: Secure API Key Generation ```python import secrets import hashlib import hmac import time import json from datetime import datetime, timedelta class APIKeyManager: """Manages secure API key lifecycle: generation, storage, validation, rotation.""" # Key format: prefix_base64random (e.g., sk_live_a1b2c3d4e5f6...) # Prefix identifies the key type and ...

Details

Author
mukul975
Repository
mukul975/Anthropic-Cybersecurity-Skills
Created
3 months ago
Last Updated
today
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

api-key-manager

API key generation, rotation, and management system

1,160 Updated today
a5c-ai
AI & Automation Featured

cohere-security-basics

Apply Cohere security best practices for API key management and access control. Use when securing API keys, implementing key rotation, or auditing Cohere security configuration. Trigger with phrases like "cohere security", "cohere secrets", "secure cohere", "cohere API key security", "cohere key rotation".

2,274 Updated today
jeremylongshore
AI & Automation Featured

groq-security-basics

Apply Groq security best practices for API key management and data protection. Use when securing API keys, implementing least privilege access, or auditing Groq security configuration. Trigger with phrases like "groq security", "groq secrets", "secure groq", "groq API key security".

2,274 Updated today
jeremylongshore
AI & Automation Featured

ideogram-security-basics

Apply Ideogram security best practices for API key management and access control. Use when securing API keys, implementing key rotation, or auditing Ideogram security configuration. Trigger with phrases like "ideogram security", "ideogram secrets", "secure ideogram", "ideogram API key security", "ideogram key rotation".

2,274 Updated today
jeremylongshore
AI & Automation Featured

klaviyo-security-basics

Apply Klaviyo security best practices for API key management and access control. Use when securing API keys, configuring OAuth scopes, implementing webhook signature verification, or auditing Klaviyo security configuration. Trigger with phrases like "klaviyo security", "klaviyo secrets", "secure klaviyo", "klaviyo API key security", "klaviyo OAuth".

2,274 Updated today
jeremylongshore