Skip to content

[SPARK-16796] [Web UI] Visible passwords on Spark environment page - #14409

Closed
Devian-ua wants to merge 4 commits into
apache:masterfrom
Devian-ua:maskpass
Closed

[SPARK-16796] [Web UI] Visible passwords on Spark environment page#14409
Devian-ua wants to merge 4 commits into
apache:masterfrom
Devian-ua:maskpass

Conversation

@Devian-ua

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we use Set for this?

@Devian-ua

Devian-ua commented Jul 29, 2016

Copy link
Copy Markdown
ContributorAuthor

@ajbozarth What if some property will be intoruduced containing "password" in its name, but not having password in its value?

@dongjoon-hyun I can change it to Set.

@ajbozarth

Copy link
Copy Markdown
Member

I'd say that that a property like that was poorly named, but it is still a valid possibility so leaving it as you have it is probably better

@ajbozarth

Copy link
Copy Markdown
Member

All in all I think this looks good

@rxin

rxin commented Jul 31, 2016

Copy link
Copy Markdown
Contributor

Perhaps everything with the name "password" we should just hide it?

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

def removePass(kv: (String, String)): (String, String) = {

Copy link
Copy Markdown
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?

@Devian-ua
Devian-uaforce-pushed the maskpass branch 2 times, most recently from 37b11ca to e97f894CompareJuly 31, 2016 14:10
@Devian-ua

Copy link
Copy Markdown
ContributorAuthor

@srowen Made removePass private. Also now it filters all properties containing "password"

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
Copy Markdown
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?

@Devian-ua

Copy link
Copy Markdown
ContributorAuthor

@srowen I think it looks cleaner when it is not inline.
On Web UI this is the only place they show up. Also they won't be masked in logs.

@srowen

Copy link
Copy Markdown
Member

Jenkins test this please

@srowen

Copy link
Copy Markdown
Member

@Devian-ua what is your ASF JIRA handle?

@Devian-ua

Copy link
Copy Markdown
ContributorAuthor

@srowen You mean username? It is asukhenko

@SparkQA

Copy link
Copy Markdown

Test build #63128 has finished for PR 14409 at commit e4b617c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen

Copy link
Copy Markdown
Member

Merged to master

@asfgitasfgit closed this in 3861273Aug 2, 2016
@a-roberts

a-roberts commented Aug 3, 2016

Copy link
Copy Markdown
Contributor

@Devian-ua
I think that while we're in the web UI we should look at masking the shared secret too (so potentially another JIRA/contribution to follow? At least something I'm interested in pursuing)

Also curious if you have any plans to backport this small change to 1.5.x and 1.6.x

@srowen

Copy link
Copy Markdown
Member

I'm OK back-porting further. It's minor and a potential security improvement. I don't think the 1.5 branch is active though.

asfgit pushed a commit that referenced this pull request Aug 3, 2016
## 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 <artur.sukhenko@gmail.com>
Closes#14409 from Devian-ua/maskpass.
(cherry picked from commit 3861273)
Signed-off-by: Sean Owen <sowen@cloudera.com>
asfgit pushed a commit that referenced this pull request Aug 3, 2016
## 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 <artur.sukhenko@gmail.com>
Closes#14409 from Devian-ua/maskpass.
(cherry picked from commit 3861273)
Signed-off-by: Sean Owen <sowen@cloudera.com>
@Devian-ua

Copy link
Copy Markdown
ContributorAuthor

@srowen@a-roberts So what should we do with spark.authenticate.secret. Do we want to mask it as well?
Something like this?

 // Spark Properties (lowercase). Their values will be changed to ***** in WebUI
private val propertiesToMask = Set("spark.authenticate.secret")
private def removePass(kv: (String, String)): (String, String) = {
if (kv._1.toLowerCase.contains("password") || propertiesToMask.contains(kv._1.toLowerCase)) {
(kv._1, "******")
} else kv
}

@ajbozarth

Copy link
Copy Markdown
Member

Lets open a follow up JIRA on this, but I would say that similar to password, secret could be masked for all instances

@srowen

Copy link
Copy Markdown
Member

If it's truly just an addendum to this issue, tacked on, just attach to the existing issue.

@Devian-ua

Copy link
Copy Markdown
ContributorAuthor

@srowen So what should I do?

@srowen

Copy link
Copy Markdown
Member

Just another PR for the same JIRA

@Devian-ua

Copy link
Copy Markdown
ContributorAuthor

@srowen Different branch?

@srowen

Copy link
Copy Markdown
Member

Yes, this is merged now.

@Devian-ua

Copy link
Copy Markdown
ContributorAuthor

@srowen I've opened #14484

zzcclp pushed a commit to zzcclp/spark that referenced this pull request Aug 4, 2016
## 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 <artur.sukhenko@gmail.com>
Closesapache#14409 from Devian-ua/maskpass.
(cherry picked from commit 3861273)
Signed-off-by: Sean Owen <sowen@cloudera.com>
(cherry picked from commit 52d8837)
asfgit pushed a commit that referenced this pull request Aug 6, 2016
## What changes were proposed in this pull request?
Mask `spark.authenticate.secret` on Spark environment page (Web UI).
This is addition to #14409
## How was this patch tested?
`./dev/run-tests`
[info] ScalaTest
[info] Run completed in 1 hour, 8 minutes, 38 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.
Author: Artur Sukhenko <artur.sukhenko@gmail.com>
Closes#14484 from Devian-ua/SPARK-16796.
@n-marion

Copy link
Copy Markdown
Contributor

A related commit #14484 hasn't been added to Spark 2.0 for 2.0.1 or 2.0.2

@srowen

Copy link
Copy Markdown
Member

This was all merged to master, meaning 2.1.x

@n-marion

Copy link
Copy Markdown
Contributor

Thanks for the quick response. I did see this in 2.1.X branch; but #14409 made it into 2.0.X, which was merged on August 3rd, while #14484 didn't which was merged on August 5th.

Although its a small change, providing sensitive information on a web UI isn't ideal, it is IMO important enough to make it into Spark 2.0.2.

@srowen

Copy link
Copy Markdown
Member

Aha I see it now. Yes I think it's fair to put in 2.0 as well. It may or may not make 2.0.2.

@n-marion

Copy link
Copy Markdown
Contributor

Appreciate that. Thank you.

asfgit pushed a commit that referenced this pull request Nov 2, 2016
## What changes were proposed in this pull request?
Mask `spark.authenticate.secret` on Spark environment page (Web UI).
This is addition to #14409
## How was this patch tested?
`./dev/run-tests`
[info] ScalaTest
[info] Run completed in 1 hour, 8 minutes, 38 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.
Author: Artur Sukhenko <artur.sukhenko@gmail.com>
Closes#14484 from Devian-ua/SPARK-16796.
(cherry picked from commit 14dba45)
Signed-off-by: Sean Owen <sowen@cloudera.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@Devian-ua@ajbozarth@rxin@srowen@SparkQA@a-roberts@n-marion@dongjoon-hyun