@@ -10,10 +10,10 @@ private import semmle.code.java.frameworks.Properties
1010 * set the `mail.smtp.ssl.socketFactory`/`mail.smtp.ssl.socketFactory.class` property to create an SMTP SSL socket.
1111 * 2. No `mail.smtp.ssl.checkserveridentity` property is enabled.
1212 */
13- predicate isInsecureMailPropertyConfig ( VarAccess propertiesVarAccess ) {
13+ predicate isInsecureMailPropertyConfig ( Variable properties ) {
1414 exists ( MethodAccess ma |
1515 ma .getMethod ( ) instanceof SetPropertyMethod and
16- ma .getQualifier ( ) = propertiesVarAccess . getVariable ( ) .getAnAccess ( )
16+ ma .getQualifier ( ) = properties .getAnAccess ( )
1717 |
1818 getStringValue ( ma .getArgument ( 0 ) ) .matches ( "%.auth%" ) and //mail.smtp.auth
1919 getStringValue ( ma .getArgument ( 1 ) ) = "true"
@@ -22,7 +22,7 @@ predicate isInsecureMailPropertyConfig(VarAccess propertiesVarAccess) {
2222 ) and
2323 not exists ( MethodAccess ma |
2424 ma .getMethod ( ) instanceof SetPropertyMethod and
25- ma .getQualifier ( ) = propertiesVarAccess . getVariable ( ) .getAnAccess ( )
25+ ma .getQualifier ( ) = properties .getAnAccess ( )
2626 |
2727 getStringValue ( ma .getArgument ( 0 ) ) .matches ( "%.ssl.checkserveridentity%" ) and //mail.smtp.ssl.checkserveridentity
2828 getStringValue ( ma .getArgument ( 1 ) ) = "true"
@@ -39,19 +39,20 @@ predicate enablesEmailSsl(MethodAccess ma) {
3939}
4040
4141/**
42- * Holds if a SSL certificate check is enabled on `va ` with Apache Email
42+ * Holds if a SSL certificate check is enabled on an access of `apacheEmail ` with Apache Email.
4343 */
44- predicate hasSslCertificateCheck ( VarAccess va ) {
44+ predicate hasSslCertificateCheck ( Variable apacheEmail ) {
4545 exists ( MethodAccess ma |
46- ma .getQualifier ( ) = va . getVariable ( ) .getAnAccess ( ) and
46+ ma .getQualifier ( ) = apacheEmail .getAnAccess ( ) and
4747 ma .getMethod ( ) .hasName ( "setSSLCheckServerIdentity" ) and
4848 ma .getMethod ( ) .getDeclaringType ( ) instanceof ApacheEmail and
4949 ma .getArgument ( 0 ) .( BooleanLiteral ) .getBooleanValue ( ) = true
5050 )
5151}
5252
5353/**
54- * Helper method to get string value of an argument
54+ * Returns the string value of `expr` if it is a `CompileTimeConstantExpr`,
55+ * or the string value of its operands if it is an `AddExpr`.
5556 */
5657private string getStringValue ( Expr expr ) {
5758 result = expr .( CompileTimeConstantExpr ) .getStringValue ( )
@@ -60,7 +61,8 @@ private string getStringValue(Expr expr) {
6061}
6162
6263/**
63- * A method to set Java properties
64+ * A method to set Java properties, either using the `Properties` class
65+ * or the `Dictionary` class.
6466 */
6567private class SetPropertyMethod extends Method {
6668 SetPropertyMethod ( ) {
0 commit comments