What does this skill do?

The Spring Boot Security Review Skill provides a comprehensive guide to implementing and auditing security in Spring Boot Java applications. It covers authentication with JWT and OAuth2, role-based authorization, strict input validation with Bean Validation, SQL injection prevention using parameterized queries, and secure secret management following the principle of least privilege.

Authentication and Authorization
Configure custom JWT filters using OncePerRequestFilter and restrict access to endpoints using @PreAuthorize and @EnableMethodSecurity.
Input Validation
Apply Bean Validation in controllers using @Valid and define strict constraints in DTOs, such as @NotBlank, @Email, and @Size.
Vulnerability Prevention
Prevent SQL injection by using parameterized queries, sanitize HTML before rendering, and configure security headers such as CSP and X-Frame-Options.
Secret Management
Hash passwords using BCrypt or Argon2, externalize credentials using environment variables or Vault, and avoid hard-coding secrets in application.yml.

Usage examples

🔑 Configure JWT
Help me set up a JWT authentication filter in my Spring Boot application that validates Bearer tokens in every request.
🛡️ Check for SQL injection
Check my Spring Data repositories and let me know if there are any queries vulnerable to SQL injection. Show me how to parameterize them.
🧪 Validate DTOs
Create a DTO with strict validations using Bean Validation for the user registration endpoint: name, email, and age.
🔐 Hardening the SecurityFilterChain
Configure my SecurityFilterChain for a stateless API with CSRF disabled, CSP headers, and strict CORS without using wildcards.

Features

JWT and OAuth2 Authentication A guide to implementing custom filters with OncePerRequestFilter and configuring OAuth2 providers in Spring Security.
Authorization by Roles and Permissions Restrict endpoints using @PreAuthorize and @EnableMethodSecurity by applying the principle of least privilege.
Preventing SQL Injection and XSS Use parameterized queries with @Query and HTML sanitization to eliminate critical vulnerabilities.
Secure Management of Secrets Hash passwords using BCrypt or Argon2, and store credentials externally using Vault or environment variables.
Rate limiting and dependency auditing Implement rate limits with Bucket4j and scan dependencies with OWASP Dependency Check or Snyk in your CI pipeline.

Frequently asked questions

Yes, this skill assumes that your Spring Boot project includes `spring-boot-starter-security`. The configurations and filters are based on Spring Security 6.
Yes. The skill covers both scenarios: CSRF disabled for stateless APIs with Bearer tokens and CSRF enabled for applications that use sessions.
You can use system environment variables or integrate HashiCorp Vault. The skill advises against hard-coding credentials in application.yml.
Yes. You can ask Claude to review your SecurityFilterChain, JPA repositories, and DTOs to detect vulnerabilities and apply the recommended fixes.
Spring Boot Security Review — Audit and Hardening with Claude AI

¿Prefieres escuchar el contenido? Genera la narración de audio con un clic.