You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/04/22 03:53:31 UTC
[GitHub] [spark] gengliangwang commented on a diff in pull request #36315: [SPARK-38992][CORE] Avoid using bash -c in ShellBasedGroupsMappingProvider
gengliangwang commented on code in PR #36315:
URL: https://github.com/apache/spark/pull/36315#discussion_r855746240
##########
core/src/main/scala/org/apache/spark/security/ShellBasedGroupsMappingProvider.scala:
##########
@@ -38,8 +38,10 @@ private[spark] class ShellBasedGroupsMappingProvider extends GroupMappingService
// shells out a "bash -c id -Gn username" to get user groups
private def getUnixGroups(username: String): Set[String] = {
- val cmdSeq = Seq("bash", "-c", "id -Gn " + username)
+ val idPath = Utils.executeAndGetOutput("which" :: "id" :: Nil).stripLineEnd
Review Comment:
I am not familiar with this. How can `executeAndGetOutput` avoid injection?
##########
core/src/main/scala/org/apache/spark/security/ShellBasedGroupsMappingProvider.scala:
##########
@@ -38,8 +38,10 @@ private[spark] class ShellBasedGroupsMappingProvider extends GroupMappingService
// shells out a "bash -c id -Gn username" to get user groups
Review Comment:
Let's update the comment as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org