Safeguard
Security Guides•

API security misconfiguration checklist for Spring, FastAPI, NestJS, Rails

OWASP API8 prevention turned into framework checks: docs, CORS, methods, error output and TLS, with a table for Spring, FastAPI, NestJS and Rails.

Safeguard Security Team
4 min read

OWASP's security misconfiguration risk is mostly a checklist: lock down environments repeatedly, review configuration, use TLS, allow only needed methods, set a CORS policy, accept only needed content types and hide stack traces. This post maps those items to what to verify in Spring, FastAPI, NestJS and Rails.

What OWASP lists

The API8:2023 page names common causes such as missing hardening, unnecessary enabled features, missing TLS, absent cache control headers, weak CORS and error messages that reveal stack traces. Its prevention advice includes a repeatable hardening process, automated configuration checks in all environments, encrypting all API communication with TLS, permitting only needed HTTP methods, a proper CORS policy for browser facing APIs, and defined response schemas including errors.

The checklist by framework

ItemWhat to verifyWhere to look
Unnecessary featuresDocs and management endpoints off or protectedFastAPI openapi_url, springdoc properties, NestJS ui and raw, Spring actuator exposure
CORSExplicit origins, no wildcard with credentialsFastAPI CORSMiddleware rules, Spring Security CORS setup
HTTP methodsOnly needed verbs routedRoute definitions in each framework
Request validationUnknown fields rejected or strippedNestJS ValidationPipe whitelist, Rails strong parameters, Pydantic models
Response shapeDeclared output models, no internalsFastAPI response_model, serializers elsewhere
ErrorsNo stack traces in responsesFramework error handlers and profile settings
TLSEnforced at proxy or appLoad balancer and app config
CSRFMatches your auth styleSpring and Rails settings

Facts from the framework docs worth knowing: Spring Boot exposes only the health endpoint over HTTP by default, but exposing everything with a wildcard is possible and the docs advise securing it. FastAPI's CORS defaults are restrictive and, with credentials enabled, wildcards are not allowed for origins, methods or headers. NestJS's ValidationPipe can strip properties without validation decorators when whitelist is true, and reject them with forbidNonWhitelisted.

Steps to run the checklist

  1. Pick one service. Do not try all at once.
  2. Build a short table like the one above with the actual setting values.
  3. Check each setting in the production profile, not in your local one.
  4. Request the risky paths from outside and record status codes.
  5. Trigger an error on purpose, such as malformed JSON, and read the response body.
  6. Fix gaps in configuration, commit them, and add a check in CI.
  7. Repeat per service and keep the table with your API inventory.

Environment drift is the real enemy

Most misconfigurations come back. A staging profile gets copied, a debug flag is left on, a wildcard is added for a demo. OWASP's advice to assess configuration effectiveness continuously with automated checks is the answer, not a one time review. See a CI test for docs endpoints for a small example, and Spring Boot actuator endpoint exposure for the management side.

Try it yourself

Click through it at your own pace, or open it full screen. Look for findings about configuration rather than code.

Safeguard's policies and gates can enforce checks in your pipeline, and a free scan covers dependencies.

Quick check

Is a stack trace in an error response a misconfiguration?

OWASP lists error messages that reveal stack traces among common causes. Define error response schemas and hide internals.

How often should I recheck?

Continuously through automated checks in CI, plus after any environment or profile change.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.