Menu

NestJS Interceptor Order: Why Stacking Breaks Your Cache
📰

NestJS Interceptor Order: Why Stacking Breaks Your Cache

DEV Community: nestjs·Parsa J·5 days ago
#5eMuCF2y
#devtonestjs#devto#dev#interceptor#next
Long article (3710 words) — no AI summary yet.
Reading 0:00
15s threshold

User 42 fetches GET /documents/7 , the document they own. The response includes isOwner: true . A minute later, user 7 — who has read access but doesn't own it — fetches the exact same document. The response also says isOwner: true . User 7 now sees an "Edit" button a permission check downstream will eventually reject, but the UI already lied to them, and a client that trusts isOwner to gate a destructive action has a real authorization bug, not a cosmetic one.

Nobody touched the authorization logic. Nobody touched the DTO. Both interceptors involved are individually correct, straight from patterns NestJS's own documentation shows.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.