API Security-Developers Checklist-Hacktivists University
API Security-Developers Checklist-Hacktivists University
COM
HACKTIVISTS
U N I V E R S I T Y
E M P OWE R IN G GR OWT H
APPLICATION
SECURITY
The Hacktivists™
Authentication
Use encryption on all sensitive data.
Implement multi-factor authentication (MFA) where possible.
Use Max Retry and account jail features to prevent brute-force attacks.
Avoid reinventing the wheel in token generation or password storage—use secure standards.
Use IP whitelisting for admin or critical APIs.
For sensitive operations, require re-authentication.
OAuth
Always validate redirect_uri server-side and only allow whitelisted URLs.
Use response_type=code instead of response_type=token to exchange codes for tokens.
Use the state parameter with a random hash to prevent CSRF attacks in the OAuth process.
Define and validate scope parameters for each application.
Revoke tokens when user permissions are modified or a security event occurs.
The Hacktivists™
The Hacktivists™
Access Control
Use HTTPS to prevent MITM (Man in the Middle) attacks.
Limit requests with rate limiting and throttling to mitigate DDoS and brute-force attacks.
Apply Role-Based Access Control (RBAC) or Attribute-Based Access Control (ABAC).
Enforce least privilege by restricting access to the minimal required.
Use API key management with strict expiration policies and scopes.
Implement CORS (Cross-Origin Resource Sharing) to control resource access from different
origins.
Use the ( HTTP Strict Transport Security ) HSTS header to avoid SSL Strip attacks.
Validate that API endpoints are properly scoped to user permissions.
Input Validation
Use the appropriate HTTP methods: GET for read, POST for create, PUT/PATCH for update, and
DELETE for removal. Respond with 405 Method Not Allowed when inappropriate methods are
used.
Validate the content-type on request headers and support only the required formats (e.g.,
application/json, application/xml).
Validate posted data types and sizes to prevent malicious input.
Use input validation libraries to prevent XSS, SQL injection, and command injection.
Avoid sending sensitive data (e.g., passwords, API keys) via the URL; use authorization headers.
Use API gateways to enable caching, rate limiting, schema validation, and dynamic deployments.
Implement size limits on request bodies to prevent buffer overflow and DoS attacks.
For APIs handling sensitive input, enforce strict input validation at both the server and client
side.
The Hacktivists™
The Hacktivists™
Output Management
Send the X-Content-Type-Options: nosniff header to prevent MIME-type sniffing.
Use the X-Frame-Options: deny header to prevent clickjacking attacks.
Set the Content-Security-Policy: default-src 'none' header to prevent cross-site scripting (XSS).
Remove unnecessary headers such as X-Powered-By, Server, and X-AspNet-Version.
Always return proper HTTP status codes (e.g., 200 OK, 400 Bad Request, 401 Unauthorized).
Force the correct content-type for all responses (e.g., application/json).
Never return sensitive information like credentials or security tokens in the response.
Include rate-limiting headers (X-Rate-Limit-Limit, X-Rate-Limit-Remaining, X-Rate-Limit-Reset).
The Hacktivists™
The Hacktivists™
Enable logging of key API usage metrics such as success/failure rates, latency, and error codes.
Use an IDS/IPS system to monitor API requests and detect malicious activity.
The Hacktivists™
HACKTIVISTS
U N I V E R S I T Y
E M POW ERING GROWT H
thehacktivists.com
/hacktivistsuniversity @hacktivistuniv