What are the core principles of API security?
Use defense in depth: TLS, strong authentication, object/function-level authorization, input validation, least privilege, rate limits, safe errors, secure secrets, logging, and timely dependency updates.
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 697–708 of 3610 questions
Use defense in depth: TLS, strong authentication, object/function-level authorization, input validation, least privilege, rate limits, safe errors, secure secrets, logging, and timely dependency updates.
Authentication establishes who the caller is; authorization decides what that identity may do to a particular resource or operation.
A JWT is a signed token containing claims.
OAuth 2.
Broken Object Level Authorization occurs when an API checks that a user is authenticated but fails to verify access to the specific object requested.
Function-level authorization ensures only permitted roles or capabilities can invoke sensitive operations.
CORS controls which browser origins may read cross-origin responses; it is not authentication and does not stop non-browser clients.
CSRF exploits ambient browser credentials such as automatically sent cookies.
APIs should avoid returning unsafe HTML and should encode or sanitize content according to its eventual output context.
Server-Side Request Forgery occurs when an attacker makes the server request unintended destinations.
Use a dedicated password-hashing algorithm such as Argon2id, scrypt, or bcrypt with an appropriate cost.
Generate high-entropy keys, show secrets only once where possible, store hashes for verification when feasible, scope permissions, set expiry/rotation, and audit usage.