Skip to content

A secuity checklist for anyone who's developing and deploying APIs

License

Notifications You must be signed in to change notification settings

dharshin/API-Security-Checklist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

API Security Checklist

This is a simplified security checklist for anyone who's developing and deploying APIs


Design

Input Validation

  • Validate all user-supplied input in the headers and in the body before they are processed
  • Validate the type (e.g. integer, string, floating point number), size (e.g. minimum string lengths, minimum abd maximum values for numbers) and format the composition of expected inputs
  • Validate the sizes of the JSON arrays and number of child elements in XML requests
  • Use built-in libraries or annotations for input validation as much as possible, build custom validators if built-in functionality is inadequate
  • Validate the size of the request body and request headers (at preferably at the API gateway)
  • Validate that the content-type in the request header matches the expected content type
  • Do not attempt to sanitise input (e.g. remove certain bad characters or strings)
  • Make sure that if input validation fail, the request is rejected with an appropriate error HTTP response

Access Control

Rate Limiting

  • Make sure that rate limiting/throttling is applied to each API based on either per-session or per-IP or based on other properties that's relevant

Authentication and Authorisation

Security Configuration

  • Make sure that APIs are exposed through secure channels such as TLS
  • Make sure that debug logging or error messages are disabled in production deployments
  • Make sure that monitoring and diagnostic endpoints provided by frameworks (e.g. Spring Boot Actuator) are either disabled or secured (HTTPS) and the exposure is controlled

Logging

  • Do not log entire the HTTP request or the HTTP headers or the entire request body as they can potentially contain sensitive information
  • Do not log user and system credentials
  • Do not log user session information (Cookies, JWT tokens, etc)

Build

  • Use third-party components that do not have vulnerabilities
  • Make sure to incorporate security testing into CI/CD processes

Security Testing

  • Make sure that static application security testing (SAST) is performed
  • Make sure that software composition analysis (SCA) scanning is performed
  • Make sure that dynamic application security testing (DAST) is performed

About

A secuity checklist for anyone who's developing and deploying APIs

Resources

License

Stars

Watchers

Forks