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. جزء من مشروع مهارات جافا المصدر: jabrena/cursor-rules-java.