Identify and apply Java secure coding practices to reduce vulnerabilities, protect sensitive data, and harden application behaviour against common attack vectors.
Prerequisites: Run ./mvnw compile or mvn compile before applying any changes. If compilation fails, stop immediately — do not proceed until the project is in a valid state.
Core areas: Input validation with type, length, format, and range checks; SQL/OS/LDAP injection defence via PreparedStatement and parameterized APIs; attack surface minimisation through least-privilege permissions and removal of unused features; strong cryptographic algorithms for hashing (passwords with BCrypt/Argon2), encryption (AES-GCM), and digital signatures while avoiding deprecated ciphers (MD5, SHA-1, DES...
신뢰할 수 없는 입력 검증, 매개변수화된 쿼리를 통한 주입 공격 방어, 최소 권한을 통한 공격 표면 최소화, 강력한 암호화 알고리즘 적용, 민감한 데이터 노출 없이 안전하게 예외 처리, 런타임 시 비밀 관리, 안전하지 않은 역직렬화 방지, XSS 방지를 위한 출력 인코딩 등 Java 보안 코딩 모범 사례를 적용해야 할 때 사용합니다. Skills-for-Java 프로젝트의 일부 출처: jabrena/cursor-rules-java.