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...
Java セキュア コーディングのベスト プラクティスを適用する必要がある場合に使用します。これには、信頼できない入力の検証、パラメーター化されたクエリによるインジェクション攻撃の防御、最小限の特権による攻撃対象領域の最小化、強力な暗号化アルゴリズムの適用、機密データを公開せずに例外を安全に処理する、実行時のシークレットの管理、安全でない逆シリアル化の回避、XSS を防止するための出力のエンコードなどが含まれます。 Skills-for-Java プロジェクトの一部 ソース: jabrena/cursor-rules-java。