The interview problem
A chat app wants titles and thumbnails for user-supplied URLs. Design an isolated preview fetcher with bounded resource use.
Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.
1. Scope and worked approach
Assume URLs are untrusted input. Parse and normalize supported schemes, validate destination addresses at connection time and after every redirect, and block prohibited internal ranges through network policy as well as application checks. Fetch without user cookies or cloud credentials in an isolated worker. Bound redirects, bytes, decompression, time and image dimensions. Cache public previews by a canonical URL policy and keep private content out of shared caches.
2. Trace the design or derivation
Validate URL → isolated fetch → revalidate redirects → parse bounded metadata → cache or omit preview
Treat returned HTML as data: extract text and approved metadata rather than execute page scripts. Strip credentials from URLs before logging and avoid forwarding authorization headers across redirects. A preview failure must not prevent the user from sending the underlying message; keep the feature outside the critical delivery path.
3. Calculate the example
A redirect limit of three permits at most four fetch hops including the initial request. A 2 MB compressed-body limit does not prevent a 200 MB decompressed response; both byte budgets need enforcement.
4. Failure cases and trade-offs
DNS rebinding and redirects can bypass validation done only on the original hostname. URL normalization can change semantics if done carelessly. Aggressive fetching improves preview coverage but increases attack surface and cost; returning a plain link is a valid fallback.
5. Validation, follow-ups and self-review
Test private-address redirects, slow streams and oversized images with controlled fixtures. Follow-up: how do you prevent cache keys from leaking private URLs? Self-review: validate every network hop and bound each processing stage.
Sources and related practice
Technical reference: cheatsheetseries.owasp.org — Server-side request validation and redirect-related SSRF boundaries.
Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.
Continue with Design a web crawler; Generate bounded image variants on demand.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.