← Java / Spring · Contents

JAVA-100 / Beginner

Including development settings and tests in production artifacts

A05:2021 Security Misconfiguration · CWE-489 Active Debug Code

Why is this a problem?

application-dev.yml, test endpoints and debug flags are exposed in production.

How to fix it

yaml
spring.profiles.active: prod   # Inject via environment variables; exclude tests from production builds

Further reading