Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions core/src/main/scala/org/apache/spark/ui/env/EnvironmentPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ import org.apache.spark.ui.{UIUtils, WebUIPage}

private[ui] class EnvironmentPage(parent: EnvironmentTab) extends WebUIPage("") {
private val listener = parent.listener

val passwordProperties: Set[String] = Set("spark.ssl.keyPassword",
"spark.ssl.keyStorePassword", "spark.ssl.trustStorePassword")

def removePass(kv: (String, String)): (String, String) = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private? agree with filtering anything whose key has "password" (not case sensitive). Check for other instances where listener.sparkProperties is accessed too?

if (passwordProperties.contains(kv._1)) {
return (kv._1, "******")
}
kv
}
def render(request: HttpServletRequest): Seq[Node] = {
val runtimeInformationTable = UIUtils.listingTable(
propertyHeader, jvmRow, listener.jvmInformation, fixedWidth = true)
val sparkPropertiesTable = UIUtils.listingTable(
propertyHeader, propertyRow, listener.sparkProperties, fixedWidth = true)
propertyHeader, propertyRow, listener.sparkProperties.map(removePass), fixedWidth = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be just taste, but isn't this easier inline?

val redactedProperties = listener.sparkProperties.map { case (key, value) => 
  (key, if (key.toLowerCase.contains("password")) "******" else value)
}

Are there any other instances where properties are displayed that need redacting?

val systemPropertiesTable = UIUtils.listingTable(
propertyHeader, propertyRow, listener.systemProperties, fixedWidth = true)
val classpathEntriesTable = UIUtils.listingTable(
Expand Down