Skip to content

Commit 52d8837

Browse files
Devian-uasrowen
authored andcommitted
[SPARK-16796][WEB UI] Visible passwords on Spark environment page
## What changes were proposed in this pull request? Mask spark.ssl.keyPassword, spark.ssl.keyStorePassword, spark.ssl.trustStorePassword in Web UI environment page. (Changes their values to ***** in env. page) ## How was this patch tested? I've built spark, run spark shell and checked that this values have been masked with *****. Also run tests: ./dev/run-tests [info] ScalaTest [info] Run completed in 1 hour, 9 minutes, 5 seconds. [info] Total number of tests run: 2166 [info] Suites: completed 65, aborted 0 [info] Tests: succeeded 2166, failed 0, canceled 0, ignored 590, pending 0 [info] All tests passed. ![mask](https://cloud.githubusercontent.com/assets/15244468/17262154/7641e132-55e2-11e6-8a6c-30ead77c7372.png) Author: Artur Sukhenko <[email protected]> Closes #14409 from Devian-ua/maskpass. (cherry picked from commit 3861273) Signed-off-by: Sean Owen <[email protected]>
1 parent 92ee6fb commit 52d8837

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/main/scala/org/apache/spark/ui/env/EnvironmentPage.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ import org.apache.spark.ui.{UIUtils, WebUIPage}
2626
private[ui] class EnvironmentPage(parent: EnvironmentTab) extends WebUIPage("") {
2727
private val listener = parent.listener
2828

29+
private def removePass(kv: (String, String)): (String, String) = {
30+
if (kv._1.toLowerCase.contains("password")) (kv._1, "******") else kv
31+
}
32+
2933
def render(request: HttpServletRequest): Seq[Node] = {
3034
val runtimeInformationTable = UIUtils.listingTable(
3135
propertyHeader, jvmRow, listener.jvmInformation, fixedWidth = true)
3236
val sparkPropertiesTable = UIUtils.listingTable(
33-
propertyHeader, propertyRow, listener.sparkProperties, fixedWidth = true)
37+
propertyHeader, propertyRow, listener.sparkProperties.map(removePass), fixedWidth = true)
3438
val systemPropertiesTable = UIUtils.listingTable(
3539
propertyHeader, propertyRow, listener.systemProperties, fixedWidth = true)
3640
val classpathEntriesTable = UIUtils.listingTable(

0 commit comments

Comments
 (0)