File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
java/ql/test/query-tests/security/CWE-273 Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -122,12 +122,23 @@ public void testSSLSocketEndpointIdSafeWithConditionalSanitizer(boolean safe) th
122
122
SSLSocket socket = (SSLSocket ) socketFactory .createSocket ();
123
123
if (safe ) {
124
124
SSLParameters sslParameters = socket .getSSLParameters ();
125
- onSetSSLParameters ( sslParameters );
125
+ sslParameters . setEndpointIdentificationAlgorithm ( "HTTPS" );
126
126
socket .setSSLParameters (sslParameters );
127
127
}
128
128
socket .getOutputStream (); // Safe
129
129
}
130
130
131
+ public void testSSLSocketEndpointIdSafeWithSanitizerInCast (boolean safe ) throws Exception {
132
+ SSLContext sslContext = SSLContext .getInstance ("TLS" );
133
+ SSLSocketFactory socketFactory = sslContext .getSocketFactory ();
134
+ Socket socket = socketFactory .createSocket ();
135
+ SSLSocket sslSocket = (SSLSocket ) socket ;
136
+ SSLParameters sslParameters = sslSocket .getSSLParameters ();
137
+ sslParameters .setEndpointIdentificationAlgorithm ("HTTPS" );
138
+ sslSocket .setSSLParameters (sslParameters );
139
+ socket .getOutputStream (); // $ SPURIOUS: hasUnsafeCertTrust
140
+ }
141
+
131
142
public void testSocketEndpointIdNotSet () throws Exception {
132
143
SocketFactory socketFactory = SocketFactory .getDefault ();
133
144
Socket socket = socketFactory .createSocket ("www.example.com" , 80 );
You can’t perform that action at this time.
0 commit comments