Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1289: Resolve relogin issue, remove spring dependency from Duo Auth, and update dependencies with vulnerabilities. #973

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021 Square, Inc.
Copyright 2023 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
okhttp (https://square.github.io/okhttp/)
---------------------------------------------

Version: 4.9.1
Version: 4.12.0
From: 'Square Inc'
License(s):
Apache 2.0
2 changes: 2 additions & 0 deletions doc/licenses/okhttp-4.12.0/dep-coordinates.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
com.squareup.okhttp3:okhttp:jar:4.12.0
com.squareup.okhttp3:logging-interceptor:jar:4.12.0
1 change: 0 additions & 1 deletion doc/licenses/okhttp-4.9.1/dep-coordinates.txt

This file was deleted.

1 change: 0 additions & 1 deletion doc/licenses/okio-2.8.0/dep-coordinates.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020 Square, Inc.
Copyright 2023 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
okio (https://square.github.io/okio/)
---------------------------------------------

Version: 2.8.0
Version: 3.6.0
From: 'Square Inc'
License(s):
Apache 2.0 (bundled/retrofit-2.9.0/LICENSE.txt)
2 changes: 2 additions & 0 deletions doc/licenses/okio-3.6.0/dep-coordinates.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
com.squareup.okio:okio:jar:3.6.0
com.squareup.okio:okio-jvm:jar:3.6.0
202 changes: 0 additions & 202 deletions doc/licenses/spring-web-5.3.25/LICENSE

This file was deleted.

7 changes: 0 additions & 7 deletions doc/licenses/spring-web-5.3.25/README

This file was deleted.

4 changes: 0 additions & 4 deletions doc/licenses/spring-web-5.3.25/dep-coordinates.txt

This file was deleted.

32 changes: 22 additions & 10 deletions extensions/guacamole-auth-duo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,32 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version> <!-- Specify the desired version -->
<version>4.12.0</version> <!-- Specify the desired version -->
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.12.0</version>
</dependency>

<!-- Force the use of a consistent version of Kotlin standard library common -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>1.4.10</version>
<version>1.9.23</version>
</dependency>

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.4.10</version>
<version>1.9.23</version>
</dependency>

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.9.23</version>
</dependency>

</dependencies>
Expand Down Expand Up @@ -95,20 +107,20 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>2.1.6</version>
<scope>provided</scope>
</dependency>

<!-- Duo SDK -->
<dependency>
<groupId>com.duosecurity</groupId>
<artifactId>duo-universal-sdk</artifactId>
<version>1.1.3</version>
</dependency>

<!-- spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.25</version>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.net.URISyntaxException;
import java.util.Collections;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.UriBuilder;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.GuacamoleServerException;
import org.apache.guacamole.auth.duo.conf.ConfigurationService;
Expand All @@ -39,7 +40,6 @@
import org.apache.guacamole.net.auth.credentials.CredentialsInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.util.UriComponentsBuilder;

/**
* Service for verifying the identity of a user against Duo.
Expand Down Expand Up @@ -102,13 +102,9 @@ public void verifyAuthenticatedUser(AuthenticatedUser authenticatedUser)

try {

String redirectUrl = confService.getRedirectUri().toString();

String builtUrl = UriComponentsBuilder
.fromUriString(redirectUrl)
String builtUrl = UriBuilder.fromUri(confService.getRedirectUri().toString())
.queryParam(Credentials.RESUME_QUERY, DuoAuthenticationProvider.PROVIDER_IDENTIFER)
.build()
.toUriString();
.build().toString();

// Set up the Duo Client
Client duoClient = new Client.Builder(
Expand All @@ -120,15 +116,10 @@ public void verifyAuthenticatedUser(AuthenticatedUser authenticatedUser)

duoClient.healthCheck();

// Retrieve signed Duo Code and State from the request
String duoCode = request.getParameter(DUO_CODE_PARAMETER_NAME);
String duoState = request.getParameter(DUO_STATE_PARAMETER_NAME);

// If no code or state is received, assume Duo MFA redirect has not occured and do it
if (duoCode == null || duoState == null) {
if (!credentials.isAuthenticationResumed()) {

// Get a new session state from the Duo client
duoState = duoClient.generateState();
String duoState = duoClient.generateState();
long expirationTimestamp = System.currentTimeMillis() + (confService.getAuthTimeout() * 1000L);

// Request additional credentials
Expand All @@ -147,6 +138,9 @@ public void verifyAuthenticatedUser(AuthenticatedUser authenticatedUser)
);

}

// Retrieve signed Duo Code and State from the request
String duoCode = request.getParameter(DUO_CODE_PARAMETER_NAME);

// Get the token from the DuoClient using the code and username, and check status
Token token = duoClient.exchangeAuthorizationCodeFor2FAResult(duoCode, username);
Expand Down
Loading
Loading