Exercises
5.1🔒BeginnerExercise 21: Write a test that sends a POST request with an empty JSON body ({}) and verifies the API returns a 400 status code with a…
5.2🔒IntermediateExercise 23: Write a rate limiting test suite that: (a) triggers 429, (b) verifies the Retry-After header, (c) waits the specified period…
5.3🔒AdvancedExercise 25: Write a comprehensive malformed request test suite that covers: invalid JSON, wrong Content-Type, extra fields (mass…
5.4🔒Q&AResume phrasing- Built error handling validation suite covering malformed payloads, content-type mismatches, and mass assignment attacks, identifying 5…
5.5🔒Q&ACover letter framingError handling and operational resilience are where API quality meets production reliability. I validate that every error path returns…
5.6🔒Q&AInterview framing"I test error handling with the mindset that every 500 response is a bug. A well-designed API should return 4xx for all client errors…
5.7🔒Q&AWhat not to say- "I do not test error handling because the API should not receive invalid input." -- Invalid input happens constantly in production…
5.8🔒Q&AQuestion 1Prompt: Your API returns a 500 error with a full Python traceback when you send a POST request with an empty body. The developer says "just…
5.9🔒Q&AQuestion 2Prompt: You need to verify that your API's rate limiter works correctly, but the rate limit is 1000 requests per minute. Running 1000…
5.10🔒Q&AQuestion 3Prompt: A new team member accidentally runs the full test suite (including destructive tests) against the production database, deleting…
5.11🔒Q&AQuestion 4Prompt: Your test suite needs to run against local, dev, staging, and production environments. Each environment has different credentials…
5.12🔒Mutation Validation TestingGraphQL's error model is fundamentally different from REST. Understanding the three types of errors is essential.
5.13🔒Syntax Errors
5.14🔒Not Found Errors
5.15🔒Partial ErrorsThis is unique to GraphQL -- a response can contain both valid data and errors simultaneously.
5.16🔒IntrospectionGraphQL introspection allows clients to query the entire schema -- useful in development but a security risk in production because it…
5.17🔒Query Depth LimitingDeeply nested queries can be used for denial-of-service attacks. A malicious client can construct a query that causes exponential database…
5.18🔒Query Complexity LimitingPRO TIP: When testing GraphQL security, think like an attacker. What is the most expensive query you can construct? Can you request 1000…