squito commented on a change in pull request #23337: [SPARK-26019][PYSPARK]
Allow insecure py4j gateways
URL: https://github.com/apache/spark/pull/23337#discussion_r242584990
##########
File path:
core/src/main/scala/org/apache/spark/api/python/PythonGatewayServer.scala
##########
@@ -43,12 +43,17 @@ private[spark] object PythonGatewayServer extends Logging {
// with the same secret, in case the app needs callbacks from the JVM to
the underlying
// python processes.
val localhost = InetAddress.getLoopbackAddress()
- val gatewayServer: GatewayServer = new GatewayServer.GatewayServerBuilder()
- .authToken(secret)
+ val builder = new GatewayServer.GatewayServerBuilder()
.javaPort(0)
.javaAddress(localhost)
.callbackClient(GatewayServer.DEFAULT_PYTHON_PORT, localhost, secret)
- .build()
+ if (sys.env.getOrElse("_PYSPARK_INSECURE_GATEWAY", "0") != "1") {
+ builder.authToken(secret)
+ } else {
+ assert(sys.env.getOrElse("SPARK_TESTING", "0") == "1",
+ "Creating insecure Java gateways only allowed for testing")
Review comment:
this warning is different than the others -- for zeppelin etc., the gateway
is created *outside* of spark, and brought in. Here, we're creating an
insecure gateway ourselves, which we should only do for testing. We dont' want
spark itself to ever create an insecure gateway
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]