Secure API design में APIs को abuse और attacks से सुरक्षित करना शामिल है — उचित authentication/authorization, input validation, rate limiting, HTTPS, और सावधानीपूर्वक data handling के माध्यम से। APIs सामान्य attack targets हैं, इसलिए उन्हें सुरक्षित करना महत्वपूर्ण है।
मुख्य API सुरक्षा प्रथाएं
✓ AUTHENTICATION → verify who's calling (API keys, OAuth tokens, JWT) — don't leave
endpoints open
✓ AUTHORIZATION → check the caller is allowed for EACH endpoint/resource (per-request,
server-side; prevent accessing others' data — broken access control / IDOR)
✓ HTTPS/TLS → always (encrypt API traffic; never plain HTTP)
✓ INPUT VALIDATION → validate/sanitize all inputs (prevent injection, malformed data)
✓ Don't EXPOSE sensitive data → return only needed fields; no secrets/internal data in responses
