[{"data":1,"prerenderedAt":955},["ShallowReactive",2],{"tag-security":3},[4],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"date":11,"layout":12,"subtitle":13,"image":14,"optimized_image":14,"category":15,"tags":16,"author":21,"paginate":7,"body":22,"_type":949,"_id":950,"_source":951,"_file":952,"_stem":953,"_extension":954},"/posts/java-security-best-practices","posts",false,"","Java Security Best Practices: Preventing Vulnerabilities and Threats","Explore essential security strategies for Java applications, addressing common vulnerabilities identified by OWASP Top 10 with practical examples.","2024-08-15T11:00:00.000Z","post","Practical Strategies to Safeguard Your Java Applications","/assets/img/uploads/java-security-best-practices.png","code",[15,17,18,19,20],"java","security","owasp","cybersecurity","jaimedearcos",{"type":23,"children":24,"toc":937},"root",[25,37,44,49,104,109,115,120,257,262,268,273,381,387,392,515,520,526,531,556,561,567,572,588,593,599,604,687,692,698,703,823,828,834,839,872,877,883,888,895,931],{"type":26,"tag":27,"props":28,"children":29},"element","blockquote",{},[30],{"type":26,"tag":31,"props":32,"children":33},"p",{},[34],{"type":35,"value":36},"text","Security is critical in software development. Java applications, like all software, face numerous potential vulnerabilities. In this article, we will explore essential security best practices, referencing the OWASP Top 10, and providing practical Java examples to help you protect your applications effectively.",{"type":26,"tag":38,"props":39,"children":41},"h2",{"id":40},"understanding-owasp-top-10",[42],{"type":35,"value":43},"Understanding OWASP Top 10",{"type":26,"tag":31,"props":45,"children":46},{},[47],{"type":35,"value":48},"The OWASP Top 10 outlines the most critical web application security risks:",{"type":26,"tag":50,"props":51,"children":52},"ol",{},[53,59,64,69,74,79,84,89,94,99],{"type":26,"tag":54,"props":55,"children":56},"li",{},[57],{"type":35,"value":58},"Injection",{"type":26,"tag":54,"props":60,"children":61},{},[62],{"type":35,"value":63},"Broken Authentication",{"type":26,"tag":54,"props":65,"children":66},{},[67],{"type":35,"value":68},"Sensitive Data Exposure",{"type":26,"tag":54,"props":70,"children":71},{},[72],{"type":35,"value":73},"XML External Entities (XXE)",{"type":26,"tag":54,"props":75,"children":76},{},[77],{"type":35,"value":78},"Broken Access Control",{"type":26,"tag":54,"props":80,"children":81},{},[82],{"type":35,"value":83},"Security Misconfiguration",{"type":26,"tag":54,"props":85,"children":86},{},[87],{"type":35,"value":88},"Cross-Site Scripting (XSS)",{"type":26,"tag":54,"props":90,"children":91},{},[92],{"type":35,"value":93},"Insecure Deserialization",{"type":26,"tag":54,"props":95,"children":96},{},[97],{"type":35,"value":98},"Using Components with Known Vulnerabilities",{"type":26,"tag":54,"props":100,"children":101},{},[102],{"type":35,"value":103},"Insufficient Logging and Monitoring",{"type":26,"tag":31,"props":105,"children":106},{},[107],{"type":35,"value":108},"Let's delve into practical strategies and Java implementations for some of these threats.",{"type":26,"tag":38,"props":110,"children":112},{"id":111},"_1-injection-prevention",[113],{"type":35,"value":114},"1. Injection Prevention",{"type":26,"tag":31,"props":116,"children":117},{},[118],{"type":35,"value":119},"Use Prepared Statements and parameterized queries:",{"type":26,"tag":121,"props":122,"children":125},"pre",{"className":123,"code":124,"language":17,"meta":8,"style":8},"language-java shiki shiki-themes github-dark github-light","PreparedStatement stmt = connection.prepareStatement(\"SELECT * FROM users WHERE username=? AND password=?\");\nstmt.setString(1, username);\nstmt.setString(2, password);\nResultSet rs = stmt.executeQuery();\n",[126],{"type":26,"tag":15,"props":127,"children":128},{"__ignoreMap":8},[129,174,203,229],{"type":26,"tag":130,"props":131,"children":134},"span",{"class":132,"line":133},"line",1,[135,141,147,152,158,163,169],{"type":26,"tag":130,"props":136,"children":138},{"style":137},"--shiki-default:#E1E4E8;--shiki-light:#24292E",[139],{"type":35,"value":140},"PreparedStatement stmt ",{"type":26,"tag":130,"props":142,"children":144},{"style":143},"--shiki-default:#F97583;--shiki-light:#D73A49",[145],{"type":35,"value":146},"=",{"type":26,"tag":130,"props":148,"children":149},{"style":137},[150],{"type":35,"value":151}," connection.",{"type":26,"tag":130,"props":153,"children":155},{"style":154},"--shiki-default:#B392F0;--shiki-light:#6F42C1",[156],{"type":35,"value":157},"prepareStatement",{"type":26,"tag":130,"props":159,"children":160},{"style":137},[161],{"type":35,"value":162},"(",{"type":26,"tag":130,"props":164,"children":166},{"style":165},"--shiki-default:#9ECBFF;--shiki-light:#032F62",[167],{"type":35,"value":168},"\"SELECT * FROM users WHERE username=? AND password=?\"",{"type":26,"tag":130,"props":170,"children":171},{"style":137},[172],{"type":35,"value":173},");\n",{"type":26,"tag":130,"props":175,"children":177},{"class":132,"line":176},2,[178,183,188,192,198],{"type":26,"tag":130,"props":179,"children":180},{"style":137},[181],{"type":35,"value":182},"stmt.",{"type":26,"tag":130,"props":184,"children":185},{"style":154},[186],{"type":35,"value":187},"setString",{"type":26,"tag":130,"props":189,"children":190},{"style":137},[191],{"type":35,"value":162},{"type":26,"tag":130,"props":193,"children":195},{"style":194},"--shiki-default:#79B8FF;--shiki-light:#005CC5",[196],{"type":35,"value":197},"1",{"type":26,"tag":130,"props":199,"children":200},{"style":137},[201],{"type":35,"value":202},", username);\n",{"type":26,"tag":130,"props":204,"children":206},{"class":132,"line":205},3,[207,211,215,219,224],{"type":26,"tag":130,"props":208,"children":209},{"style":137},[210],{"type":35,"value":182},{"type":26,"tag":130,"props":212,"children":213},{"style":154},[214],{"type":35,"value":187},{"type":26,"tag":130,"props":216,"children":217},{"style":137},[218],{"type":35,"value":162},{"type":26,"tag":130,"props":220,"children":221},{"style":194},[222],{"type":35,"value":223},"2",{"type":26,"tag":130,"props":225,"children":226},{"style":137},[227],{"type":35,"value":228},", password);\n",{"type":26,"tag":130,"props":230,"children":232},{"class":132,"line":231},4,[233,238,242,247,252],{"type":26,"tag":130,"props":234,"children":235},{"style":137},[236],{"type":35,"value":237},"ResultSet rs ",{"type":26,"tag":130,"props":239,"children":240},{"style":143},[241],{"type":35,"value":146},{"type":26,"tag":130,"props":243,"children":244},{"style":137},[245],{"type":35,"value":246}," stmt.",{"type":26,"tag":130,"props":248,"children":249},{"style":154},[250],{"type":35,"value":251},"executeQuery",{"type":26,"tag":130,"props":253,"children":254},{"style":137},[255],{"type":35,"value":256},"();\n",{"type":26,"tag":31,"props":258,"children":259},{},[260],{"type":35,"value":261},"This approach prevents SQL injection by ensuring that input data is treated as data, not executable code.",{"type":26,"tag":38,"props":263,"children":265},{"id":264},"_2-secure-authentication",[266],{"type":35,"value":267},"2. Secure Authentication",{"type":26,"tag":31,"props":269,"children":270},{},[271],{"type":35,"value":272},"Implement robust authentication using secure password storage (bcrypt or Argon2):",{"type":26,"tag":121,"props":274,"children":276},{"className":123,"code":275,"language":17,"meta":8,"style":8},"import org.springframework.security.crypto.bcrypt.BCrypt;\n\nString hashedPassword = BCrypt.hashpw(password, BCrypt.gensalt());\nif (BCrypt.checkpw(password, hashedPassword)) {\n    // authentication successful\n}\n",[277],{"type":26,"tag":15,"props":278,"children":279},{"__ignoreMap":8},[280,293,302,339,362,372],{"type":26,"tag":130,"props":281,"children":282},{"class":132,"line":133},[283,288],{"type":26,"tag":130,"props":284,"children":285},{"style":143},[286],{"type":35,"value":287},"import",{"type":26,"tag":130,"props":289,"children":290},{"style":137},[291],{"type":35,"value":292}," org.springframework.security.crypto.bcrypt.BCrypt;\n",{"type":26,"tag":130,"props":294,"children":295},{"class":132,"line":176},[296],{"type":26,"tag":130,"props":297,"children":299},{"emptyLinePlaceholder":298},true,[300],{"type":35,"value":301},"\n",{"type":26,"tag":130,"props":303,"children":304},{"class":132,"line":205},[305,310,314,319,324,329,334],{"type":26,"tag":130,"props":306,"children":307},{"style":137},[308],{"type":35,"value":309},"String hashedPassword ",{"type":26,"tag":130,"props":311,"children":312},{"style":143},[313],{"type":35,"value":146},{"type":26,"tag":130,"props":315,"children":316},{"style":137},[317],{"type":35,"value":318}," BCrypt.",{"type":26,"tag":130,"props":320,"children":321},{"style":154},[322],{"type":35,"value":323},"hashpw",{"type":26,"tag":130,"props":325,"children":326},{"style":137},[327],{"type":35,"value":328},"(password, BCrypt.",{"type":26,"tag":130,"props":330,"children":331},{"style":154},[332],{"type":35,"value":333},"gensalt",{"type":26,"tag":130,"props":335,"children":336},{"style":137},[337],{"type":35,"value":338},"());\n",{"type":26,"tag":130,"props":340,"children":341},{"class":132,"line":231},[342,347,352,357],{"type":26,"tag":130,"props":343,"children":344},{"style":143},[345],{"type":35,"value":346},"if",{"type":26,"tag":130,"props":348,"children":349},{"style":137},[350],{"type":35,"value":351}," (BCrypt.",{"type":26,"tag":130,"props":353,"children":354},{"style":154},[355],{"type":35,"value":356},"checkpw",{"type":26,"tag":130,"props":358,"children":359},{"style":137},[360],{"type":35,"value":361},"(password, hashedPassword)) {\n",{"type":26,"tag":130,"props":363,"children":365},{"class":132,"line":364},5,[366],{"type":26,"tag":130,"props":367,"children":369},{"style":368},"--shiki-default:#6A737D;--shiki-light:#6A737D",[370],{"type":35,"value":371},"    // authentication successful\n",{"type":26,"tag":130,"props":373,"children":375},{"class":132,"line":374},6,[376],{"type":26,"tag":130,"props":377,"children":378},{"style":137},[379],{"type":35,"value":380},"}\n",{"type":26,"tag":38,"props":382,"children":384},{"id":383},"_3-sensitive-data-exposure",[385],{"type":35,"value":386},"3. Sensitive Data Exposure",{"type":26,"tag":31,"props":388,"children":389},{},[390],{"type":35,"value":391},"Use encryption for sensitive data storage:",{"type":26,"tag":121,"props":393,"children":395},{"className":123,"code":394,"language":17,"meta":8,"style":8},"Cipher cipher = Cipher.getInstance(\"AES/GCM/NoPadding\");\nSecretKey key = generateSecretKey();\ncipher.init(Cipher.ENCRYPT_MODE, key);\nbyte[] encryptedData = cipher.doFinal(plainData.getBytes(StandardCharsets.UTF_8));\n",[396],{"type":26,"tag":15,"props":397,"children":398},{"__ignoreMap":8},[399,434,455,473],{"type":26,"tag":130,"props":400,"children":401},{"class":132,"line":133},[402,407,411,416,421,425,430],{"type":26,"tag":130,"props":403,"children":404},{"style":137},[405],{"type":35,"value":406},"Cipher cipher ",{"type":26,"tag":130,"props":408,"children":409},{"style":143},[410],{"type":35,"value":146},{"type":26,"tag":130,"props":412,"children":413},{"style":137},[414],{"type":35,"value":415}," Cipher.",{"type":26,"tag":130,"props":417,"children":418},{"style":154},[419],{"type":35,"value":420},"getInstance",{"type":26,"tag":130,"props":422,"children":423},{"style":137},[424],{"type":35,"value":162},{"type":26,"tag":130,"props":426,"children":427},{"style":165},[428],{"type":35,"value":429},"\"AES/GCM/NoPadding\"",{"type":26,"tag":130,"props":431,"children":432},{"style":137},[433],{"type":35,"value":173},{"type":26,"tag":130,"props":435,"children":436},{"class":132,"line":176},[437,442,446,451],{"type":26,"tag":130,"props":438,"children":439},{"style":137},[440],{"type":35,"value":441},"SecretKey key ",{"type":26,"tag":130,"props":443,"children":444},{"style":143},[445],{"type":35,"value":146},{"type":26,"tag":130,"props":447,"children":448},{"style":154},[449],{"type":35,"value":450}," generateSecretKey",{"type":26,"tag":130,"props":452,"children":453},{"style":137},[454],{"type":35,"value":256},{"type":26,"tag":130,"props":456,"children":457},{"class":132,"line":205},[458,463,468],{"type":26,"tag":130,"props":459,"children":460},{"style":137},[461],{"type":35,"value":462},"cipher.",{"type":26,"tag":130,"props":464,"children":465},{"style":154},[466],{"type":35,"value":467},"init",{"type":26,"tag":130,"props":469,"children":470},{"style":137},[471],{"type":35,"value":472},"(Cipher.ENCRYPT_MODE, key);\n",{"type":26,"tag":130,"props":474,"children":475},{"class":132,"line":231},[476,481,486,490,495,500,505,510],{"type":26,"tag":130,"props":477,"children":478},{"style":143},[479],{"type":35,"value":480},"byte",{"type":26,"tag":130,"props":482,"children":483},{"style":137},[484],{"type":35,"value":485},"[] encryptedData ",{"type":26,"tag":130,"props":487,"children":488},{"style":143},[489],{"type":35,"value":146},{"type":26,"tag":130,"props":491,"children":492},{"style":137},[493],{"type":35,"value":494}," cipher.",{"type":26,"tag":130,"props":496,"children":497},{"style":154},[498],{"type":35,"value":499},"doFinal",{"type":26,"tag":130,"props":501,"children":502},{"style":137},[503],{"type":35,"value":504},"(plainData.",{"type":26,"tag":130,"props":506,"children":507},{"style":154},[508],{"type":35,"value":509},"getBytes",{"type":26,"tag":130,"props":511,"children":512},{"style":137},[513],{"type":35,"value":514},"(StandardCharsets.UTF_8));\n",{"type":26,"tag":31,"props":516,"children":517},{},[518],{"type":35,"value":519},"Always encrypt data at rest and in transit (use HTTPS).",{"type":26,"tag":38,"props":521,"children":523},{"id":522},"_4-security-misconfiguration",[524],{"type":35,"value":525},"4. Security Misconfiguration",{"type":26,"tag":31,"props":527,"children":528},{},[529],{"type":35,"value":530},"Adopt secure defaults, disable debugging, and avoid detailed error messages:",{"type":26,"tag":121,"props":532,"children":536},{"className":533,"code":534,"language":535,"meta":8,"style":8},"language-properties shiki shiki-themes github-dark github-light","server.error.include-stacktrace=never\nserver.error.include-message=never\n","properties",[537],{"type":26,"tag":15,"props":538,"children":539},{"__ignoreMap":8},[540,548],{"type":26,"tag":130,"props":541,"children":542},{"class":132,"line":133},[543],{"type":26,"tag":130,"props":544,"children":545},{},[546],{"type":35,"value":547},"server.error.include-stacktrace=never\n",{"type":26,"tag":130,"props":549,"children":550},{"class":132,"line":176},[551],{"type":26,"tag":130,"props":552,"children":553},{},[554],{"type":35,"value":555},"server.error.include-message=never\n",{"type":26,"tag":31,"props":557,"children":558},{},[559],{"type":35,"value":560},"Review and secure your Java application configuration regularly.",{"type":26,"tag":38,"props":562,"children":564},{"id":563},"_5-cross-site-scripting-xss",[565],{"type":35,"value":566},"5. Cross-Site Scripting (XSS)",{"type":26,"tag":31,"props":568,"children":569},{},[570],{"type":35,"value":571},"Utilize proper encoding or frameworks that prevent XSS by default, such as Thymeleaf:",{"type":26,"tag":121,"props":573,"children":577},{"className":574,"code":575,"language":576,"meta":8,"style":8},"language-html shiki shiki-themes github-dark github-light","\u003Cp th:text=\"${userInput}\">\u003C/p>\n","html",[578],{"type":26,"tag":15,"props":579,"children":580},{"__ignoreMap":8},[581],{"type":26,"tag":130,"props":582,"children":583},{"class":132,"line":133},[584],{"type":26,"tag":130,"props":585,"children":586},{},[587],{"type":35,"value":575},{"type":26,"tag":31,"props":589,"children":590},{},[591],{"type":35,"value":592},"Avoid directly inserting user inputs into HTML without proper sanitization or encoding.",{"type":26,"tag":38,"props":594,"children":596},{"id":595},"_6-insecure-deserialization",[597],{"type":35,"value":598},"6. Insecure Deserialization",{"type":26,"tag":31,"props":600,"children":601},{},[602],{"type":35,"value":603},"Limit deserialization to trusted sources only:",{"type":26,"tag":121,"props":605,"children":607},{"className":123,"code":606,"language":17,"meta":8,"style":8},"ObjectInputStream ois = new ObjectInputStream(new FileInputStream(\"trusted_data.ser\"));\nMyObject obj = (MyObject) ois.readObject();\n",[608],{"type":26,"tag":15,"props":609,"children":610},{"__ignoreMap":8},[611,661],{"type":26,"tag":130,"props":612,"children":613},{"class":132,"line":133},[614,619,623,628,633,637,642,647,651,656],{"type":26,"tag":130,"props":615,"children":616},{"style":137},[617],{"type":35,"value":618},"ObjectInputStream ois ",{"type":26,"tag":130,"props":620,"children":621},{"style":143},[622],{"type":35,"value":146},{"type":26,"tag":130,"props":624,"children":625},{"style":143},[626],{"type":35,"value":627}," new",{"type":26,"tag":130,"props":629,"children":630},{"style":154},[631],{"type":35,"value":632}," ObjectInputStream",{"type":26,"tag":130,"props":634,"children":635},{"style":137},[636],{"type":35,"value":162},{"type":26,"tag":130,"props":638,"children":639},{"style":143},[640],{"type":35,"value":641},"new",{"type":26,"tag":130,"props":643,"children":644},{"style":154},[645],{"type":35,"value":646}," FileInputStream",{"type":26,"tag":130,"props":648,"children":649},{"style":137},[650],{"type":35,"value":162},{"type":26,"tag":130,"props":652,"children":653},{"style":165},[654],{"type":35,"value":655},"\"trusted_data.ser\"",{"type":26,"tag":130,"props":657,"children":658},{"style":137},[659],{"type":35,"value":660},"));\n",{"type":26,"tag":130,"props":662,"children":663},{"class":132,"line":176},[664,669,673,678,683],{"type":26,"tag":130,"props":665,"children":666},{"style":137},[667],{"type":35,"value":668},"MyObject obj ",{"type":26,"tag":130,"props":670,"children":671},{"style":143},[672],{"type":35,"value":146},{"type":26,"tag":130,"props":674,"children":675},{"style":137},[676],{"type":35,"value":677}," (MyObject) ois.",{"type":26,"tag":130,"props":679,"children":680},{"style":154},[681],{"type":35,"value":682},"readObject",{"type":26,"tag":130,"props":684,"children":685},{"style":137},[686],{"type":35,"value":256},{"type":26,"tag":31,"props":688,"children":689},{},[690],{"type":35,"value":691},"Always validate deserialized data.",{"type":26,"tag":38,"props":693,"children":695},{"id":694},"_7-component-vulnerabilities",[696],{"type":35,"value":697},"7. Component Vulnerabilities",{"type":26,"tag":31,"props":699,"children":700},{},[701],{"type":35,"value":702},"Regularly update libraries and dependencies, and use tools like OWASP Dependency-Check to identify vulnerabilities:",{"type":26,"tag":121,"props":704,"children":708},{"className":705,"code":706,"language":707,"meta":8,"style":8},"language-xml shiki shiki-themes github-dark github-light","\u003Cplugin>\n    \u003CgroupId>org.owasp\u003C/groupId>\n    \u003CartifactId>dependency-check-maven\u003C/artifactId>\n    \u003Cversion>9.0.9\u003C/version>\n\u003C/plugin>\n","xml",[709],{"type":26,"tag":15,"props":710,"children":711},{"__ignoreMap":8},[712,731,757,782,807],{"type":26,"tag":130,"props":713,"children":714},{"class":132,"line":133},[715,720,726],{"type":26,"tag":130,"props":716,"children":717},{"style":137},[718],{"type":35,"value":719},"\u003C",{"type":26,"tag":130,"props":721,"children":723},{"style":722},"--shiki-default:#85E89D;--shiki-light:#22863A",[724],{"type":35,"value":725},"plugin",{"type":26,"tag":130,"props":727,"children":728},{"style":137},[729],{"type":35,"value":730},">\n",{"type":26,"tag":130,"props":732,"children":733},{"class":132,"line":176},[734,739,744,749,753],{"type":26,"tag":130,"props":735,"children":736},{"style":137},[737],{"type":35,"value":738},"    \u003C",{"type":26,"tag":130,"props":740,"children":741},{"style":722},[742],{"type":35,"value":743},"groupId",{"type":26,"tag":130,"props":745,"children":746},{"style":137},[747],{"type":35,"value":748},">org.owasp\u003C/",{"type":26,"tag":130,"props":750,"children":751},{"style":722},[752],{"type":35,"value":743},{"type":26,"tag":130,"props":754,"children":755},{"style":137},[756],{"type":35,"value":730},{"type":26,"tag":130,"props":758,"children":759},{"class":132,"line":205},[760,764,769,774,778],{"type":26,"tag":130,"props":761,"children":762},{"style":137},[763],{"type":35,"value":738},{"type":26,"tag":130,"props":765,"children":766},{"style":722},[767],{"type":35,"value":768},"artifactId",{"type":26,"tag":130,"props":770,"children":771},{"style":137},[772],{"type":35,"value":773},">dependency-check-maven\u003C/",{"type":26,"tag":130,"props":775,"children":776},{"style":722},[777],{"type":35,"value":768},{"type":26,"tag":130,"props":779,"children":780},{"style":137},[781],{"type":35,"value":730},{"type":26,"tag":130,"props":783,"children":784},{"class":132,"line":231},[785,789,794,799,803],{"type":26,"tag":130,"props":786,"children":787},{"style":137},[788],{"type":35,"value":738},{"type":26,"tag":130,"props":790,"children":791},{"style":722},[792],{"type":35,"value":793},"version",{"type":26,"tag":130,"props":795,"children":796},{"style":137},[797],{"type":35,"value":798},">9.0.9\u003C/",{"type":26,"tag":130,"props":800,"children":801},{"style":722},[802],{"type":35,"value":793},{"type":26,"tag":130,"props":804,"children":805},{"style":137},[806],{"type":35,"value":730},{"type":26,"tag":130,"props":808,"children":809},{"class":132,"line":364},[810,815,819],{"type":26,"tag":130,"props":811,"children":812},{"style":137},[813],{"type":35,"value":814},"\u003C/",{"type":26,"tag":130,"props":816,"children":817},{"style":722},[818],{"type":35,"value":725},{"type":26,"tag":130,"props":820,"children":821},{"style":137},[822],{"type":35,"value":730},{"type":26,"tag":31,"props":824,"children":825},{},[826],{"type":35,"value":827},"Execute dependency checks regularly in your CI/CD pipeline.",{"type":26,"tag":38,"props":829,"children":831},{"id":830},"_8-logging-and-monitoring",[832],{"type":35,"value":833},"8. Logging and Monitoring",{"type":26,"tag":31,"props":835,"children":836},{},[837],{"type":35,"value":838},"Implement comprehensive logging and monitoring to detect and respond to security incidents:",{"type":26,"tag":121,"props":840,"children":842},{"className":123,"code":841,"language":17,"meta":8,"style":8},"logger.warn(\"Failed login attempt for user: {}\", username);\n",[843],{"type":26,"tag":15,"props":844,"children":845},{"__ignoreMap":8},[846],{"type":26,"tag":130,"props":847,"children":848},{"class":132,"line":133},[849,854,859,863,868],{"type":26,"tag":130,"props":850,"children":851},{"style":137},[852],{"type":35,"value":853},"logger.",{"type":26,"tag":130,"props":855,"children":856},{"style":154},[857],{"type":35,"value":858},"warn",{"type":26,"tag":130,"props":860,"children":861},{"style":137},[862],{"type":35,"value":162},{"type":26,"tag":130,"props":864,"children":865},{"style":165},[866],{"type":35,"value":867},"\"Failed login attempt for user: {}\"",{"type":26,"tag":130,"props":869,"children":870},{"style":137},[871],{"type":35,"value":202},{"type":26,"tag":31,"props":873,"children":874},{},[875],{"type":35,"value":876},"Aggregate logs centrally, and set up alerts for suspicious activities.",{"type":26,"tag":38,"props":878,"children":880},{"id":879},"conclusion",[881],{"type":35,"value":882},"Conclusion",{"type":26,"tag":31,"props":884,"children":885},{},[886],{"type":35,"value":887},"Adopting these best practices can greatly enhance the security posture of your Java applications. Stay proactive by regularly reviewing security measures, updating dependencies, and monitoring your systems. Security is a continuous process, not a one-time setup.",{"type":26,"tag":889,"props":890,"children":892},"h1",{"id":891},"further-reading",[893],{"type":35,"value":894},"Further Reading",{"type":26,"tag":896,"props":897,"children":898},"ul",{},[899,911,921],{"type":26,"tag":54,"props":900,"children":901},{},[902],{"type":26,"tag":903,"props":904,"children":908},"a",{"href":905,"rel":906},"https://owasp.org/www-project-top-ten/",[907],"nofollow",[909],{"type":35,"value":910},"OWASP Top 10",{"type":26,"tag":54,"props":912,"children":913},{},[914],{"type":26,"tag":903,"props":915,"children":918},{"href":916,"rel":917},"https://spring.io/projects/spring-security",[907],[919],{"type":35,"value":920},"Spring Security",{"type":26,"tag":54,"props":922,"children":923},{},[924],{"type":26,"tag":903,"props":925,"children":928},{"href":926,"rel":927},"https://owasp.org/www-project-dependency-check/",[907],[929],{"type":35,"value":930},"OWASP Dependency Check",{"type":26,"tag":932,"props":933,"children":934},"style",{},[935],{"type":35,"value":936},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}",{"title":8,"searchDepth":176,"depth":176,"links":938},[939,940,941,942,943,944,945,946,947,948],{"id":40,"depth":176,"text":43},{"id":111,"depth":176,"text":114},{"id":264,"depth":176,"text":267},{"id":383,"depth":176,"text":386},{"id":522,"depth":176,"text":525},{"id":563,"depth":176,"text":566},{"id":595,"depth":176,"text":598},{"id":694,"depth":176,"text":697},{"id":830,"depth":176,"text":833},{"id":879,"depth":176,"text":882},"markdown","content:posts:java-security-best-practices.md","content","posts/java-security-best-practices.md","posts/java-security-best-practices","md",1790510065393]