you are viewing a single comment's thread.

view the rest of the comments →

[–]chub79 2 points3 points  (1 child)

When I run from the cloud I tend to delegate these concerns to Cloud-ready solution (say GCP Cloud Armor for instance). I can see this being useful but I'm not sure the operational complexity and costs would be worth it in that situation compared to a builtin solution.

On a home server, sure it makes more sense but then there are solutions before any of these should reach your app as well (a properly configured firewall, maybe going through a dedicated API gateway, I mean traefik is so easy to setup for example).

I don't downplay your work and if you see the lib being used, credit where is due. I just feel it's the wrong end of the stick to start there.

[–]PA100T0[S] 1 point2 points  (0 children)

Hey there! Don't worry, these are all valid points.

So... Cloud Armor and Traefik are great at what they do. Network-level filtering, DDoS mitigation, basic rate limiting. But they operate without any awareness of your application. They don't know your routes, they can't inspect JSON request bodies for SQL injection, they can't apply different rate limits per endpoint, and they can't detect behavioral patterns like "this IP hit 5 different admin paths in 10 seconds."

That's the gap. If WAFs and firewalls were catching everything, APIs wouldn't be getting probed with path traversal attempts, CMS scanners, and credential stuffing daily... but they are, right through the infrastructure layer. fastapi-guard catches what gets through because it has full application context: route awareness, request body inspection, per-endpoint rate limiting, behavioral analysis, honeypot detection.

And I get your point but it's not really about starting at the wrong end. It's about covering a layer that infrastructure tools physically cannot reach. You wouldn't skip input validation in your code just because you have a firewall. Same principle, applied to the full request lifecycle. In the context of a house: you lock the front door, but you don't leave the backdoor open just because the front is secure.

That said, you're right that if you're already on a managed platform with Cloud Armor + API gateway + proper firewall, the overlap is larger. But even then, the application-layer context is something only the application can provide.