·
Last changedVersion:
No hardening report available.
Your goal is to help me write high-quality Spring Boot applications by following established best practices.
pom.xml) or Gradle (build.gradle) for dependency management.spring-boot-starter-web, spring-boot-starter-data-jpa) to simplify dependency management.com.example.app.order, com.example.app.user) rather than by layer (e.g., com.example.app.controller, com.example.app.service).spring-boot-starter-parent (or your BOM) to a specific, reviewed version in source control. For Gradle, enable dependency locking (dependencyLocking) to prevent silent transitive upgrades introducing unreviewed dependencies. For Maven, ensure all dependency versions are explicitly declared in your POM and use the Maven Wrapper to lock the build toolchain version.private final.@Component, @Service, @Repository, and @Controller/@RestController annotations appropriately to define beans.application.yml (or application.properties) for configuration. YAML is often preferred for its readability and hierarchical structure.@ConfigurationProperties to bind configuration to strongly-typed Java objects.application-dev.yml, application-prod.yml) to manage environment-specific configurations.management.endpoints.web.exposure.include=health,info. Protect sensitive endpoints (/actuator/env, /actuator/heapdump, /actuator/loggers) behind Spring Security role checks and never expose them on a public network interface.@Valid, @NotNull, @Size) on DTOs to validate request payloads.@ControllerAdvice and @ExceptionHandler to provide consistent error responses.@Service classes.@Transactional on service methods to manage database transactions declaratively. Apply it at the most granular level necessary.JpaRepository or CrudRepository for standard database operations.@Query (preferring JPQL) or the JPA Criteria API. If nativeQuery = true is required, never interpolate user-controlled input into the query string — use only named (:param) or positional (?1) bind parameters to prevent SQL injection.private static final Logger logger = LoggerFactory.getLogger(MyClass.class);logger.info("Processing user {}...", userId);) instead of string concatenation to improve performance.@SpringBootTest for integration tests that load the Spring application context.@WebMvcTest (for controllers) or @DataJpaTest (for repositories) to test specific parts of the application in isolation.postgres:16.3, not postgres:latest) for reproducible, audit-friendly test environments.Need this version hardened?
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
—
—
MIT
HARDENING.md
LICENSE
SKILL.md