API Endpoint Security Checklist
API Endpoint Security Checklist
Checklist
Prepared by HANIM EKEN
https://ie.linkedin.com/in/hanimeken
https://ie.linkedin.com/in/hanimeken
1. Authentication
Use Strong Authentication Mechanisms: Implement strong methods like OAuth 2.0
or OpenID Connect.
Enforce Multi-Factor Authentication (MFA): Add a second layer of security for
accessing the API.
Avoid API Keys in URLs: Always use headers for sensitive data transmission.
Use Short-Lived Tokens: Employ short-lived tokens like JWT with expiration times.
2. Authorization
Use Role-Based Access Control (RBAC): Limit access based on the user’s role.
Verify Permissions for Every API Call: Ensure proper authorization for each
resource.
Avoid Over-Permissive Roles: Assign minimum permissions required for each role.
Validate All Input Data: Ensure the data conforms to the expected format (e.g.,
length, type).
Sanitize Inputs to Prevent Injection Attacks: Protect against SQL injection and
other code injection vulnerabilities.
Use Whitelists for Allowed Values: Reject anything outside predefined allowed
values.
Implement Rate Limiting: Prevent abuse by limiting the number of API requests
allowed per user/IP.
Set Quotas for API Usage: Define usage quotas to prevent DoS attacks.
Implement Throttling: Temporarily block excessive traffic to prevent overloading.
5. Encryption
Enforce HTTPS: Ensure all data transmitted over the API is encrypted using
TLS/SSL.
Encrypt Sensitive Data in Transit: Protect personal data, credentials, or tokens
during transmission.
Encrypt Sensitive Data at Rest: Encrypt sensitive stored data like API keys,
passwords, or PII.
https://ie.linkedin.com/in/hanimeken
6. Logging and Monitoring
Log All API Requests and Responses: Capture information such as user activity,
timestamps, and API usage patterns.
Monitor Suspicious Activity: Look for abnormal behavior such as brute-force
attacks or large bursts of traffic.
Enable Auditing: Set up audit logs to track who accessed what and when.
Limit Public Exposure: Avoid exposing sensitive API endpoints to the public.
Use API Gateways: Centralize security measures such as authentication, rate
limiting, and IP whitelisting.
Disable Unused Endpoints: Remove or deactivate endpoints that are no longer in
use.
Avoid Verbose Error Messages: Return minimal error information to avoid
disclosing sensitive details.
Configure CORS Properly: Ensure you allow only trusted domains to access your
APIs.
Avoid Wide Open CORS Policies: Limit cross-origin requests by setting precise
origins.
Use Secure Cookies: Ensure the secure and HttpOnly flags are set for cookies.
Regenerate Tokens on Logout: Invalidate session tokens when users log out.
Use Token Expiry: Implement token expiration and refresh mechanisms to maintain
session security.
Use Versioning for Your API: Manage deprecation of older, less secure versions.
Avoid Mixing Old and New APIs: Keep deprecated versions separated from newer
secure ones.
https://ie.linkedin.com/in/hanimeken
11. Testing and Patching
Regularly Test for Vulnerabilities: Perform security tests such as penetration testing
and fuzz testing.
Apply Security Patches: Update API software and dependencies with the latest
patches.
Automate Security Testing: Incorporate security scans in your CI/CD pipeline.
12. Documentation
Provide Clear API Documentation: Help users understand the security measures
they need to take.
Do Not Expose Sensitive Information: Ensure that documentation does not disclose
sensitive data like API keys.
HANIM EKEN
https://ie.linkedin.com/in/hanimeken
https://ie.linkedin.com/in/hanimeken