You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by va...@apache.org on 2018/02/21 02:06:27 UTC

spark git commit: [SPARK-23468][CORE] Stringify auth secret before storing it in credentials.

Repository: spark
Updated Branches:
  refs/heads/master 2ba77ed9e -> 6d398c05c


[SPARK-23468][CORE] Stringify auth secret before storing it in credentials.

The secret is used as a string in many parts of the code, so it has
to be turned into a hex string to avoid issues such as the random
byte sequence not containing a valid UTF8 sequence.

Author: Marcelo Vanzin <va...@cloudera.com>

Closes #20643 from vanzin/SPARK-23468.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/6d398c05
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/6d398c05
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/6d398c05

Branch: refs/heads/master
Commit: 6d398c05cbad69aa9093429e04ae44c73b81cd5a
Parents: 2ba77ed
Author: Marcelo Vanzin <va...@cloudera.com>
Authored: Tue Feb 20 18:06:21 2018 -0800
Committer: Marcelo Vanzin <va...@cloudera.com>
Committed: Tue Feb 20 18:06:21 2018 -0800

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/SecurityManager.scala | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/6d398c05/core/src/main/scala/org/apache/spark/SecurityManager.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/SecurityManager.scala b/core/src/main/scala/org/apache/spark/SecurityManager.scala
index 4c1dbe3..5b15a1c 100644
--- a/core/src/main/scala/org/apache/spark/SecurityManager.scala
+++ b/core/src/main/scala/org/apache/spark/SecurityManager.scala
@@ -541,7 +541,8 @@ private[spark] class SecurityManager(
     rnd.nextBytes(secretBytes)
 
     val creds = new Credentials()
-    creds.addSecretKey(SECRET_LOOKUP_KEY, secretBytes)
+    val secretStr = HashCodes.fromBytes(secretBytes).toString()
+    creds.addSecretKey(SECRET_LOOKUP_KEY, secretStr.getBytes(UTF_8))
     UserGroupInformation.getCurrentUser().addCredentials(creds)
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org