Skip to content

Commit ad7a92a

Browse files
authoredMay 6, 2022
Revert "chore(deps): upgrade play dependencies to remove CVE vulnerabilities (datahub-project#4820)" (datahub-project#4861)
This reverts commit fa4abea.
1 parent 11489b6 commit ad7a92a

20 files changed

+85
-173
lines changed
 

‎.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,4 @@ metadata-ingestion/generated/**
6464
# docs
6565
docs/generated/
6666
tmp*
67-
temp*
68-
69-
# frontend assets
70-
datahub-frontend/public/**
67+
temp*

‎build.gradle

+7-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ buildscript {
1616
}
1717
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
1818
classpath "com.palantir.gradle.gitversion:gradle-git-version:0.12.3"
19-
classpath "org.gradle.playframework:gradle-playframework:0.12"
2019
classpath "gradle.plugin.org.hidetake:gradle-swagger-generator-plugin:2.18.1"
2120
}
2221
}
@@ -111,14 +110,14 @@ project.ext.externalDependency = [
111110
'opentracingJdbc':'io.opentracing.contrib:opentracing-jdbc:0.2.15',
112111
'parquet': 'org.apache.parquet:parquet-avro:1.12.2',
113112
'picocli': 'info.picocli:picocli:4.5.0',
114-
'playCache': 'com.typesafe.play:play-cache_2.12:2.7.6',
115-
'playWs': 'com.typesafe.play:play-ahc-ws-standalone_2.12:2.0.8',
116-
'playDocs': 'com.typesafe.play:play-docs_2.12:2.7.6',
117-
'playGuice': 'com.typesafe.play:play-guice_2.12:2.7.6',
118-
'playJavaJdbc': 'com.typesafe.play:play-java-jdbc_2.12:2.7.6',
119-
'playTest': 'com.typesafe.play:play-test_2.12:2.7.6',
113+
'playCache': 'com.typesafe.play:play-cache_2.11:2.6.18',
114+
'playWs': 'com.typesafe.play:play-ahc-ws-standalone_2.11:2.0.8',
115+
'playDocs': 'com.typesafe.play:play-docs_2.11:2.6.18',
116+
'playGuice': 'com.typesafe.play:play-guice_2.11:2.6.18',
117+
'playJavaJdbc': 'com.typesafe.play:play-java-jdbc_2.11:2.6.18',
118+
'playTest': 'com.typesafe.play:play-test_2.11:2.6.18',
120119
'pac4j': 'org.pac4j:pac4j-oidc:3.6.0',
121-
'playPac4j': 'org.pac4j:play-pac4j_2.12:8.0.2',
120+
'playPac4j': 'org.pac4j:play-pac4j_2.11:7.0.1',
122121
'postgresql': 'org.postgresql:postgresql:42.3.3',
123122
'protobuf': 'com.google.protobuf:protobuf-java:3.19.3',
124123
'reflections': 'org.reflections:reflections:0.9.9',

‎datahub-frontend/app/auth/AuthModule.java

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.linkedin.util.Configuration;
1313
import com.datahub.authentication.Authentication;
1414
import java.nio.charset.StandardCharsets;
15+
import java.security.MessageDigest;
1516
import java.util.Collections;
1617
import org.apache.commons.codec.digest.DigestUtils;
1718
import org.pac4j.core.client.Client;
+1-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package auth;
22

33
import com.typesafe.config.Config;
4-
import java.util.Optional;
54
import javax.inject.Inject;
65
import play.mvc.Http;
76
import play.mvc.Result;
@@ -23,8 +22,7 @@ public class Authenticator extends Security.Authenticator {
2322

2423
@Inject
2524
public Authenticator(@Nonnull Config config) {
26-
this.metadataServiceAuthEnabled = config.hasPath(METADATA_SERVICE_AUTH_ENABLED_CONFIG_PATH)
27-
&& config.getBoolean(METADATA_SERVICE_AUTH_ENABLED_CONFIG_PATH);
25+
this.metadataServiceAuthEnabled = config.hasPath(METADATA_SERVICE_AUTH_ENABLED_CONFIG_PATH) && config.getBoolean(METADATA_SERVICE_AUTH_ENABLED_CONFIG_PATH);
2826
}
2927

3028
@Override
@@ -40,28 +38,9 @@ public String getUsername(@Nonnull Http.Context ctx) {
4038
}
4139
}
4240

43-
@Override
44-
public Optional<String> getUsername(@Nonnull Http.Request request) {
45-
Http.Context ctx = Http.Context.current();
46-
if (this.metadataServiceAuthEnabled) {
47-
// If Metadata Service auth is enabled, we only want to verify presence of the
48-
// "Authorization" header OR the presence of a frontend generated session cookie.
49-
// At this time, the actor is still considered to be unauthenicated.
50-
return Optional.ofNullable(AuthUtils.isEligibleForForwarding(ctx) ? "urn:li:corpuser:UNKNOWN" : null);
51-
} else {
52-
// If Metadata Service auth is not enabled, verify the presence of a valid session cookie.
53-
return Optional.ofNullable(AuthUtils.hasValidSessionCookie(ctx) ? ctx.session().get(ACTOR) : null);
54-
}
55-
}
56-
5741
@Override
5842
@Nonnull
5943
public Result onUnauthorized(@Nullable Http.Context ctx) {
6044
return unauthorized();
6145
}
62-
63-
@Override
64-
public Result onUnauthorized(Http.Request req) {
65-
return unauthorized();
66-
}
6746
}

‎datahub-frontend/app/auth/sso/oidc/OidcResponseErrorHandler.java

+9-12
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010

1111

1212
public class OidcResponseErrorHandler {
13-
14-
private OidcResponseErrorHandler() {
15-
16-
}
17-
1813
private static final Logger _logger = LoggerFactory.getLogger("OidcResponseErrorHandler");
1914

2015
private static final String ERROR_FIELD_NAME = "error";
@@ -27,18 +22,20 @@ public static Result handleError(final PlayWebContext context) {
2722
getErrorDescription(context));
2823

2924
if (getError(context).equals("access_denied")) {
30-
return unauthorized(String.format("Access denied. "
31-
+ "The OIDC service responded with 'Access denied'. "
32-
+ "It seems that you don't have access to this application yet. Please apply for access. \n\n"
33-
+ "If you already have been assigned this application, it may be so that your OIDC request is still in action. "
34-
+ "Error details: '%s':'%s'",
25+
return unauthorized(String.format("Access denied. " +
26+
"The OIDC service responded with 'Access denied'. " +
27+
"It seems that you don't have access to this application yet. Please apply for access. \n\n" +
28+
"If you already have been assigned this application, it may be so that your OIDC request is still in action. " +
29+
"Error details: '%s':'%s'",
3530
context.getRequestParameter("error"),
3631
context.getRequestParameter("error_description")));
3732
}
3833

3934
return internalServerError(
40-
String.format("Internal server error. The OIDC service responded with an error: '%s'.\n"
41-
+ "Error description: '%s'", getError(context), getErrorDescription(context)));
35+
String.format("Internal server error. The OIDC service responded with an error: '%s'.\n" +
36+
"Error description: '%s'",
37+
getError(context),
38+
getErrorDescription(context)));
4239
}
4340

4441
public static boolean isError(final PlayWebContext context) {

‎datahub-frontend/app/auth/sso/oidc/custom/CustomOidcAuthenticator.java

+9-13
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,8 @@ public CustomOidcAuthenticator(final OidcConfiguration configuration, final Oidc
7171
chosenMethod = preferredMethod;
7272
} else {
7373
throw new TechnicalException(
74-
"Preferred authentication method ("
75-
+ preferredMethod
76-
+ ") not supported "
77-
+ "by provider according to provider metadata ("
78-
+ metadataMethods
79-
+ ").");
74+
"Preferred authentication method (" + preferredMethod + ") not supported " +
75+
"by provider according to provider metadata (" + metadataMethods + ").");
8076
}
8177
} else {
8278
chosenMethod = firstSupportedMethod(metadataMethods);
@@ -87,13 +83,13 @@ public CustomOidcAuthenticator(final OidcConfiguration configuration, final Oidc
8783
chosenMethod);
8884
}
8985

90-
final ClientID clientID = new ClientID(configuration.getClientId());
86+
final ClientID _clientID = new ClientID(configuration.getClientId());
9187
if (ClientAuthenticationMethod.CLIENT_SECRET_POST.equals(chosenMethod)) {
92-
final Secret secret = new Secret(configuration.getSecret());
93-
clientAuthentication = new ClientSecretPost(clientID, secret);
88+
final Secret _secret = new Secret(configuration.getSecret());
89+
clientAuthentication = new ClientSecretPost(_clientID, _secret);
9490
} else if (ClientAuthenticationMethod.CLIENT_SECRET_BASIC.equals(chosenMethod)) {
95-
final Secret secret = new Secret(configuration.getSecret());
96-
clientAuthentication = new ClientSecretBasic(clientID, secret);
91+
final Secret _secret = new Secret(configuration.getSecret());
92+
clientAuthentication = new ClientSecretBasic(_clientID, _secret);
9793
} else if (ClientAuthenticationMethod.NONE.equals(chosenMethod)) {
9894
clientAuthentication = null; // No client authentication in none mode
9995
} else {
@@ -132,8 +128,8 @@ private static ClientAuthenticationMethod firstSupportedMethod(final List<Client
132128
if (firstSupported.isPresent()) {
133129
return firstSupported.get();
134130
} else {
135-
throw new TechnicalException("None of the Token endpoint provider metadata authentication methods are supported: "
136-
+ metadataMethods);
131+
throw new TechnicalException("None of the Token endpoint provider metadata authentication methods are supported: " +
132+
metadataMethods);
137133
}
138134
}
139135

‎datahub-frontend/app/client/AuthServiceClient.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ public String generateSessionTokenForUser(@Nonnull final String userId) {
5656
try {
5757

5858
final String protocol = this.metadataServiceUseSsl ? "https" : "http";
59-
final HttpPost request = new HttpPost(String.format("%s://%s:%s/%s", protocol, this.metadataServiceHost,
60-
this.metadataServicePort, GENERATE_SESSION_TOKEN_ENDPOINT));
59+
final HttpPost request = new HttpPost(String.format("%s://%s:%s/%s", protocol, this.metadataServiceHost, this.metadataServicePort, GENERATE_SESSION_TOKEN_ENDPOINT));
6160

6261
// Build JSON request to generate a token on behalf of a user.
6362
String json = String.format("{ \"%s\":\"%s\" }", USER_ID_FIELD, userId);

‎datahub-frontend/app/controllers/Application.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import java.util.concurrent.CompletableFuture;
1515
import java.util.concurrent.ExecutionException;
1616
import java.util.stream.Collectors;
17-
import play.api.Play;
17+
import play.Play;
1818
import play.http.HttpEntity;
1919
import play.libs.ws.InMemoryBodyWritable;
2020
import play.libs.ws.StandaloneWSClient;
@@ -59,7 +59,7 @@ public Application(@Nonnull Config config) {
5959
*/
6060
@Nonnull
6161
private Result serveAsset(@Nullable String path) {
62-
InputStream indexHtml = Play.current().classloader().getResourceAsStream("public/index.html");
62+
InputStream indexHtml = Play.application().classloader().getResourceAsStream("public/index.html");
6363
response().setHeader("Cache-Control", "no-cache");
6464
return ok(indexHtml).as("text/html");
6565
}
@@ -114,8 +114,7 @@ public CompletableFuture<Result> proxy(String path) throws ExecutionException, I
114114
.toMap()
115115
.entrySet()
116116
.stream()
117-
// Remove X-DataHub-Actor to prevent malicious delegation.
118-
.filter(entry -> !AuthenticationConstants.LEGACY_X_DATAHUB_ACTOR_HEADER.equals(entry.getKey()))
117+
.filter(entry -> !AuthenticationConstants.LEGACY_X_DATAHUB_ACTOR_HEADER.equals(entry.getKey())) // Remove X-DataHub-Actor to prevent malicious delegation.
119118
.filter(entry -> !Http.HeaderNames.CONTENT_LENGTH.equals(entry.getKey()))
120119
.filter(entry -> !Http.HeaderNames.CONTENT_TYPE.equals(entry.getKey()))
121120
.filter(entry -> !Http.HeaderNames.AUTHORIZATION.equals(entry.getKey()))

‎datahub-frontend/app/controllers/CentralLogoutController.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ public class CentralLogoutController extends LogoutController {
1919
@Inject
2020
public CentralLogoutController(Config config) {
2121

22-
String authBaseUrl = config.hasPath(AUTH_BASE_URL_CONFIG_PATH)
22+
String _authBaseUrl = config.hasPath(AUTH_BASE_URL_CONFIG_PATH)
2323
? config.getString(AUTH_BASE_URL_CONFIG_PATH)
2424
: DEFAULT_BASE_URL_PATH;
2525

2626
_isOidcEnabled = config.hasPath("auth.oidc.enabled") && config.getBoolean("auth.oidc.enabled");
2727

28-
setDefaultUrl(authBaseUrl);
29-
setLogoutUrlPattern(authBaseUrl + ".*");
28+
setDefaultUrl(_authBaseUrl);
29+
setLogoutUrlPattern(_authBaseUrl + ".*");
3030
setLocalLogout(true);
3131
setCentralLogout(true);
3232

‎datahub-frontend/app/controllers/SsoCallbackController.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public class SsoCallbackLogic implements CallbackLogic<Result, PlayWebContext> {
5858

5959
private final OidcCallbackLogic _oidcCallbackLogic;
6060

61-
SsoCallbackLogic(final SsoManager ssoManager, final Authentication systemAuthentication,
62-
final EntityClient entityClient, final AuthServiceClient authClient) {
61+
SsoCallbackLogic(final SsoManager ssoManager, final Authentication systemAuthentication, final EntityClient entityClient, final AuthServiceClient authClient) {
6362
_oidcCallbackLogic = new OidcCallbackLogic(ssoManager, systemAuthentication, entityClient, authClient);
6463
}
6564

‎datahub-frontend/app/controllers/TrackingController.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class TrackingController extends Controller {
3535
private final Logger _logger = LoggerFactory.getLogger(TrackingController.class.getName());
3636

3737
private static final List<String> KAFKA_SSL_PROTOCOLS = Collections.unmodifiableList(
38-
Arrays.asList(SecurityProtocol.SSL.name(), SecurityProtocol.SASL_SSL.name(),
38+
Arrays.asList(SecurityProtocol.SSL.name(),SecurityProtocol.SASL_SSL.name(),
3939
SecurityProtocol.SASL_PLAINTEXT.name()));
4040

4141
private final Boolean _isEnabled;
@@ -81,7 +81,7 @@ public Result track() throws Exception {
8181
_producer.send(record);
8282
_producer.flush();
8383
return ok();
84-
} catch (Exception e) {
84+
} catch(Exception e) {
8585
_logger.error(String.format("Failed to emit product analytics event. actor: %s, event: %s", actor, event));
8686
return internalServerError(e.getMessage());
8787
}

‎datahub-frontend/app/security/AuthenticationManager.java

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public void handle(@Nonnull Callback[] callbacks) {
4444
NameCallback nc = null;
4545
PasswordCallback pc = null;
4646
for (Callback callback : callbacks) {
47-
Logger.error("The submitted callback is of type: " + callback.getClass() + " : " + callback);
4847
if (callback instanceof NameCallback) {
4948
nc = (NameCallback) callback;
5049
nc.setName(this.username);

‎datahub-frontend/app/utils/ConfigUtil.java

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
public class ConfigUtil {
88

9-
private ConfigUtil() {
10-
11-
}
12-
139
// New configurations, provided via application.conf file.
1410
public static final String METADATA_SERVICE_HOST_CONFIG_PATH = "metadataService.host";
1511
public static final String METADATA_SERVICE_PORT_CONFIG_PATH = "metadataService.port";

‎datahub-frontend/build.gradle

-17
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,4 @@ graphqlCodegen {
4646

4747
tasks.withType(Checkstyle) {
4848
exclude "**/generated/**"
49-
}
50-
51-
checkstyleMain.source = "app/"
52-
53-
54-
/*
55-
PLAY UPGRADE NOTE
56-
Generates the distribution jars under the expected names. The playFramework plugin only accepts certain name values
57-
for the resulting folders and files, so some changes were made to accommodate. Default distribution is main if these are excluded
58-
*/
59-
distributions {
60-
create("datahub-frontend") {
61-
distributionBaseName = project.ext.playBinaryBaseName
62-
}
63-
playBinary {
64-
distributionBaseName = project.ext.playBinaryBaseName
65-
}
6649
}

‎datahub-frontend/conf/application.conf

-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ play.modules.disabled += "play.api.mvc.CookiesModule"
2626
play.modules.enabled += "play.api.mvc.LegacyCookiesModule"
2727
play.modules.enabled += "auth.AuthModule"
2828

29-
# Legacy Configuration to avoid code changes, update to modern approaches eventually
30-
play.allowHttpContext = true
31-
play.allowGlobalApplication = true
32-
3329
# Database configuration
3430
# ~~~~~
3531
# You can declare as many datasources as you want.

‎datahub-frontend/conf/routes

+11-11
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ POST /callback/:protocol co
1919
GET /logOut controllers.CentralLogoutController.executeLogout()
2020

2121
# Proxies API requests to the metadata service api
22-
GET /api/*path controllers.Application.proxy(path)
23-
POST /api/*path controllers.Application.proxy(path)
24-
DELETE /api/*path controllers.Application.proxy(path)
25-
PUT /api/*path controllers.Application.proxy(path)
22+
GET /api/*path controllers.Application.proxy(path)
23+
POST /api/*path controllers.Application.proxy(path)
24+
DELETE /api/*path controllers.Application.proxy(path)
25+
PUT /api/*path controllers.Application.proxy(path)
2626

2727
# Proxies API requests to the metadata service api
28-
GET /openapi/*path controllers.Application.proxy(path)
29-
POST /openapi/*path controllers.Application.proxy(path)
30-
DELETE /openapi/*path controllers.Application.proxy(path)
31-
PUT /openapi/*path controllers.Application.proxy(path)
28+
GET /openapi/*path controllers.Application.proxy(path)
29+
POST /openapi/*path controllers.Application.proxy(path)
30+
DELETE /openapi/*path controllers.Application.proxy(path)
31+
PUT /openapi/*path controllers.Application.proxy(path)
3232

3333
# Map static resources from the /public folder to the /assets URL path
34-
GET /assets/*file controllers.Assets.at(path="/public", file)
34+
GET /assets/*file controllers.Assets.at(path="/public", file)
3535

3636
# Analytics route
37-
POST /track controllers.TrackingController.track()
37+
POST /track controllers.TrackingController.track()
3838

3939
# Wildcard route accepts any routes and delegates to serveAsset which in turn serves the React Bundle
40-
GET /*path controllers.Application.index(path)
40+
GET /*path controllers.Application.index(path)

0 commit comments

Comments
 (0)
Please sign in to comment.