Files
codeql/java/ql/test/query-tests/security/CWE-297/InsecureJavaMailTest.ql
Tony Torralba a86cbd884e Apply suggestions from code review
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2021-10-05 09:40:22 +02:00

25 lines
824 B
Plaintext

import java
import semmle.code.java.security.Mail
import TestUtilities.InlineExpectationsTest
class InsecureJavaMailTest extends InlineExpectationsTest {
InsecureJavaMailTest() { this = "HasInsecureJavaMailTest" }
override string getARelevantTag() { result = "hasInsecureJavaMail" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasInsecureJavaMail" and
exists(MethodAccess ma |
ma.getLocation() = location and
element = ma.toString() and
value = ""
|
ma.getMethod() instanceof MailSessionGetInstanceMethod and
isInsecureMailPropertyConfig(ma.getArgument(0).(VarAccess).getVariable())
or
enablesEmailSsl(ma) and
not hasSslCertificateCheck(ma.getQualifier().(VarAccess).getVariable())
)
}
}