Debug Rate Limiting and Inappropriate-Word Checks in a Full-Stack Movie Review App
Company: Amazon
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Online Assessment
In a timed online assessment you receive the source code of a movie review website, where users rate movies and write review comments. The project is large, with many files spread across a frontend and a backend, and it contains several bugs. Your task is to find and fix them so that the site behaves as intended. Two of the bugs are in features to look at first: the rate limiting does not work as it should, and the validation that keeps inappropriate words out of review comments is faulty. The project includes tests you can run once your changes are in place, and an AI coding assistant is available, for example to help locate the relevant files.
The time limit is tight, and understanding how the services fit together takes a large share of it.
### Clarifying Questions
- Is there a written description of the intended behavior, or do the provided tests define it?
- Which requests should be rate limited, keyed by what (user account or client address), with what limit and window, and what response should a limited request receive?
- Where does the list of inappropriate words come from, and should matching be case-insensitive and on whole words only, or on any substring?
- Should a comment containing an inappropriate word be rejected, or saved with the word masked?
- Is the result graded only by the provided tests, or by hidden tests as well?
### Part 1 — Find your way through the codebase
Before changing anything, trace what happens when a user submits a review: from the form in the frontend, through the API call, to the backend route, its middleware and the code that stores the review. Identify where rate limiting and comment validation are supposed to happen.
```hint Start from the failures
Consider what the test suite can tell you about the bugs before you have read most of the files.
```
#### What This Part Should Cover
- A deliberate way to locate the entry points and follow one request end to end
- Using the test suite and the AI assistant to narrow the search, while checking what the assistant claims
- A time budget for orientation versus fixing
### Part 2 — Fix the rate limiting
Find why rate limiting does not work and fix it. Describe the kinds of defect you would look for, implement a limiter that enforces the intended limit, and show how you would test it.
```hint Where the count lives
Ask where the limiter keeps its counts, under what key it counts, and whether that state survives from one request to the next.
```
#### What This Part Should Cover
- The plausible failure points: wiring, key, window arithmetic, comparison and state lifetime
- A correct limiting algorithm and the response a limited request receives
- Deterministic tests, including the boundary request and the window reset
### Part 3 — Fix the inappropriate-word validation
Review comments containing inappropriate words are not handled correctly. Find the defect, fix the validation, and make sure it cannot be bypassed.
```hint Test both directions
Try comments that should be rejected and comments that should pass, varying letter case, punctuation, and words that merely contain a listed word.
```
#### What This Part Should Cover
- Normalization and matching rules: case, word boundaries and punctuation
- Enforcement on the server, not only in the frontend form
- Tests for missed words and for wrongly rejected comments
### Part 4 — Find the remaining bugs and verify
The report says there were several bugs in total. With the time left, find the others and confirm that your fixes work without breaking anything else.
```hint Let the tests drive
Think about the order in which you run tests and check the frontend, so that the last minutes are not spent on manual clicking alone.
```
#### What This Part Should Cover
- A systematic triage of the remaining failures
- A regression test for each fix
- A full test run before time runs out
### What a Strong Answer Covers
- Orients quickly by following one request path instead of reading files at random
- Traces each named bug to a specific root cause before editing
- Fixes rate limiting and word validation on the server, with correct boundaries and responses
- Keeps changes small and consistent with the project's existing stack and style
- Uses the AI assistant for navigation and drafts, and verifies its output
- Runs the tests, adds regression tests and leaves time for verification
### Follow-up Questions
- The backend runs as several instances behind a load balancer. How does your rate limiter change?
- Users evade the word filter with spacing, symbols or look-alike characters. How far would you go, and what would it cost in wrongly rejected comments?
- Requests reach the service through a proxy. Which client identity would you rate limit on, and what could go wrong?
- How would you keep these bugs from coming back?
Overview: Amazon online assessment task: debug a full-stack movie review website where users rate movies and comment on them. Find and fix several bugs, including broken rate limiting and faulty inappropriate-word validation of review comments, while navigating a large frontend and backend codebase under time pressure.
Read the full Amazon Software Engineer interview experience this question came from