ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

api-security-best-practices

Implement secure API design patterns including authentication, authorization, input validation, rate limiting, and protection against common API vulnerabilities

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/mupengi-bot/api-security-best-practices
Or

API Security Best Practices 🐧

Overview

Guide developers in building secure APIs by implementing authentication, authorization, input validation, rate limiting, and protection against common vulnerabilities. This skill covers security patterns for REST, GraphQL, and WebSocket APIs.

When to Use This Skill

  • Use when designing new API endpoints
  • Use when securing existing APIs
  • Use when implementing authentication and authorization
  • Use when protecting against API attacks (injection, DDoS, etc.)
  • Use when conducting API security reviews
  • Use when preparing for security audits
  • Use when implementing rate limiting and throttling
  • Use when handling sensitive data in APIs

How It Works

Step 1: Authentication & Authorization

I'll help you implement secure authentication:

  • Choose authentication method (JWT, OAuth 2.0, API keys)
  • Implement token-based authentication
  • Set up role-based access control (RBAC)
  • Secure session management
  • Implement multi-factor authentication (MFA)

Step 2: Input Validation & Sanitization

Protect against injection attacks:

  • Validate all input data
  • Sanitize user inputs
  • Use parameterized queries
  • Implement request schema validation
  • Prevent SQL injection, XSS, and command injection

Step 3: Rate Limiting & Throttling

Prevent abuse and DDoS attacks:

  • Implement rate limiting per user/IP
  • Set up API throttling
  • Configure request quotas
  • Handle rate limit errors gracefully
  • Monitor for suspicious activity

Step 4: Data Protection

Secure sensitive data:

  • Encrypt data in transit (HTTPS/TLS)
  • Encrypt sensitive data at rest
  • Implement proper error handling (no data leaks)
  • Sanitize error messages
  • Use secure headers

Step 5: API Security Testing

Verify security implementation:

  • Test authentication and authorization
  • Perform penetration testing
  • Check for common vulnerabilities (OWASP API Top 10)
  • Validate input handling
  • Test rate limiting

Examples

Example 1: Implementing JWT Authentication

## Secure JWT Authentication Implementation

### Authentication Flow

1. User logs in with credentials
2. Server validates credentials
3. Server generates JWT token
4. Client stores token securely
5. Client sends token with each request
6. Server validates token

### Implementation

#### 1. Generate Secure JWT Tokens

\`\`\`javascript
// auth.js
const jwt = require('jsonwebtoken');
const bcrypt = require('bcrypt');

Metadata

Stars1335
Views0
Updated2026-02-23
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-mupengi-bot-api-security-best-practices": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.