classNotCompliant{publicvoidmyMethod(){Emailemail=newSimpleEmail();email.setHostName("smtp.servermail.com");email.setSmtpPort(465);email.setAuthenticator(newDefaultAuthenticator(username,password));// email.setSSLOnConnect(true);email.setFrom("user@gmail.com");email.setSubject("TestMail");email.setMsg("This is a test mail ... :-)");email.addTo("foo@bar.com");email.send();}}
Compliant Code Examples
classCompliant{publicvoidmyMethod(){Emailemail=newSimpleEmail();email.setHostName("smtp.servermail.com");email.setSmtpPort(465);email.setAuthenticator(newDefaultAuthenticator(username,password));email.setSSLOnConnect(true);email.setFrom("user@gmail.com");email.setSubject("TestMail");email.setMsg("This is a test mail ... :-)");email.addTo("foo@bar.com");email.setSSLCheckServerIdentity(true);email.send();}}
Seamless integrations. Try Datadog Code Analysis
Datadog Code Analysis
Try this rule and analyze your code with Datadog Code Analysis
How to use this rule
1
2
rulesets:- java-security # Rules to enforce Java security.
Create a static-analysis.datadog.yml with the content above at the root of your repository
Use our free IDE Plugins or add Code Analysis scans to your CI pipelines