Skip to content

Commit

Permalink
remove netty server as its has a security vunerability
Browse files Browse the repository at this point in the history
  • Loading branch information
ldetmer committed Aug 22, 2024
1 parent 8b54078 commit 06f05e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 31 deletions.
19 changes: 1 addition & 18 deletions google-api-client-apache-v5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</goals>
<configuration>
<configLocation>google_checks.xml</configLocation>
<suppressionsLocation>src/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
<suppressionsLocation>${project.basedir}/src/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
Expand Down Expand Up @@ -190,29 +190,12 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency> -->
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<type>test-jar</type>
<scope>test</scope>
<version>2.6.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-core</artifactId>
<version>5.14.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
<version>5.14.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<!-- Test checkstyle suppressions -->
<suppress checks="MissingJavadocType" files="src/test/"/>
<suppress checks="AbbreviationAsWordInName" files="src/test/"/>
<suppress checks="VariableDeclarationUsageDistance" files="src/test/"/>
<suppress checks="MissingJavadocType" files="/src/test/"/>
<suppress checks="AbbreviationAsWordInName" files="/src/test/"/>
<suppress checks="VariableDeclarationUsageDistance" files="/src/test/"/>
</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,14 @@
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.io.HttpClientResponseHandler;
import org.junit.Test;
import org.mockserver.integration.ClientAndServer;
import org.mockserver.socket.PortFactory;

public class ITGoogleApache5HttpTransportTest {

@Test
public void testHttpRequestFailsWhenMakingRequestToSiteWithoutGoogleCerts()
throws GeneralSecurityException, IOException {
int port = PortFactory.findFreePort();
// MockServer handles all SSL traffic transparently by auto-generating an appropriate SSL
// certificate using their own cert
// https://github.com/mock-server/mockserver/blob/master/mockserver-core/src/main/resources/org/mockserver/socket/CertificateAuthorityCertificate.pem
ClientAndServer mockServer = ClientAndServer.startClientAndServer(port);
Apache5HttpTransport apache5HttpTransport = GoogleApache5HttpTransport.newTrustedTransport();
HttpGet httpGet = new HttpGet("https://localhost:" + port + "/");
HttpGet httpGet = new HttpGet("https://bing.com");
Exception exception = null;
try {
apache5HttpTransport
Expand All @@ -63,8 +56,6 @@ public Void handleResponse(ClassicHttpResponse response) {

assertNotNull(exception);
assertEquals(exception.getClass(), SSLHandshakeException.class);

mockServer.stop();
}

@Test
Expand Down

0 comments on commit 06f05e4

Please sign in to comment.