AI-generated backend code tends to pass tests while shipping serious security vulnerabilities by default — unbounded body sizes, wildcard CORS with credentials, SSRF-prone fetch calls, and missing auth. The author argues the fix isn't more vigilance but inverting defaults so the safe path is the easy path. Using DaloyJS (their own TypeScript framework) as a concrete example, they demonstrate secure-by-default patterns: hard body limits, SSRF-guarded fetch that re-validates redirects, refuse-to-boot on wildcard CORS in production, weak session secrets, and unauthenticated state-changing routes. JWT algorithm confusion attacks are closed by construction. Supply chain risks are addressed via zero runtime dependencies, npm provenance, SBOMs, and pnpm settings that block scripts and enforce a 24-hour package release age. The post honestly acknowledges limitations: broken object-level authorization still requires correct developer logic, and DaloyJS is a new beta with a smaller ecosystem than Express or Fastify.

23m read timeFrom stackoverflow.blog
Post cover image
Table of contents
Exhibit A: the backend your assistant just wroteThe actual thesis: invert the defaultThe same app, with the defaults flippedRefuse to boot: the feature I am most attached toSSRF: the attack surface everyone forgets, right when it got more dangerousTokens and the confused deputyThe contract is a security boundary, not just nice typesThe other half of the attack surface is your node_modulesWhere this does not save you, said plainlyThe boring conclusion
87.3K Impressions4 Comments