Repository: spark Updated Branches: refs/heads/branch-2.3 a1ee6f1fc -> 1d78f03ae
[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 <van...@cloudera.com> Closes #20643 from vanzin/SPARK-23468. (cherry picked from commit 6d398c05cbad69aa9093429e04ae44c73b81cd5a) Signed-off-by: Marcelo Vanzin <van...@cloudera.com> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/1d78f03a Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/1d78f03a Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/1d78f03a Branch: refs/heads/branch-2.3 Commit: 1d78f03ae3037f1ddbe6533a6733b7805a6705bf Parents: a1ee6f1 Author: Marcelo Vanzin <van...@cloudera.com> Authored: Tue Feb 20 18:06:21 2018 -0800 Committer: Marcelo Vanzin <van...@cloudera.com> Committed: Tue Feb 20 18:06:31 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/1d78f03a/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-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org