Skip to content

Same NestJS Prompt. Claude Got 6 Security Errors. Gemini Got 2. Here's What Both Got Wrong.

8.3 relevance
Score Breakdown
technical depth
8
novelty
7
actionability
8
community
5
strategic
5
personal
9

Scored daily by a customisable AI persona to surface the most relevant engineering leadership news.

Direct comparison of AI code generation security is highly actionable.

2026-05-30 Security dev.to
Same NestJS Prompt. Claude Got 6 Security Errors. Gemini Got 2. Here's What Both Got Wrong.
Summary

Claude Sonnet 4.6 generated 6 security errors (no guards, exposed fields, debug endpoint) while Gemini 2.5 Flash produced 2 errors (both missing rate limiting) for the same NestJS users service prompt. Both omitted rate limiting on login, but Gemini's output included class-level guards and @Exclude() on password, showing toolchain choice affects default security posture.

Key Takeaways
  • Audit AI-generated NestJS code for missing rate limiting, guard decorators, and exposed sensitive fields regardless of which LLM toolchain you use.
Why it matters

As AI-generated code becomes part of your SDLC, the toolchain you use (Anthropic vs Google) directly impacts the security baseline of your NestJS services, requiring proactive auditing even for simple scaffolding.

Author

Ofri Peretz

More from Ofri Peretz →