Skip to content

Conversation

@Devian-ua
Copy link
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
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
Copy link
Contributor Author

Devian-ua commented Jul 29, 2016

@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
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
Member

All in all I think this looks good

@rxin
Copy link
Contributor

rxin commented Jul 31, 2016

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
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-ua force-pushed the maskpass branch 2 times, most recently from 37b11ca to e97f894 Compare July 31, 2016 14:10
@Devian-ua
Copy link
Contributor Author

@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
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
Contributor Author

@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
Member

srowen commented Aug 2, 2016

Jenkins test this please

@srowen
Copy link
Member

srowen commented Aug 2, 2016

@Devian-ua what is your ASF JIRA handle?

@Devian-ua
Copy link
Contributor Author

@srowen You mean username? It is asukhenko

@SparkQA
Copy link

SparkQA commented Aug 2, 2016

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
Member

srowen commented Aug 2, 2016

Merged to master

@asfgit asfgit closed this in 3861273 Aug 2, 2016
@a-roberts
Copy link
Contributor

a-roberts commented Aug 3, 2016

@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
Member

srowen commented Aug 3, 2016

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 <[email protected]>

Closes #14409 from Devian-ua/maskpass.

(cherry picked from commit 3861273)
Signed-off-by: Sean Owen <[email protected]>
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 <[email protected]>

Closes #14409 from Devian-ua/maskpass.

(cherry picked from commit 3861273)
Signed-off-by: Sean Owen <[email protected]>
@Devian-ua
Copy link
Contributor Author

@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
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
Member

srowen commented Aug 3, 2016

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

@Devian-ua
Copy link
Contributor Author

@srowen So what should I do?

@srowen
Copy link
Member

srowen commented Aug 3, 2016

Just another PR for the same JIRA

@Devian-ua
Copy link
Contributor Author

@srowen Different branch?

@srowen
Copy link
Member

srowen commented Aug 3, 2016

Yes, this is merged now.

@Devian-ua
Copy link
Contributor Author

@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 <[email protected]>

Closes apache#14409 from Devian-ua/maskpass.

(cherry picked from commit 3861273)
Signed-off-by: Sean Owen <[email protected]>
(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 <[email protected]>

Closes #14484 from Devian-ua/SPARK-16796.
@n-marion
Copy link
Contributor

n-marion commented Nov 2, 2016

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

@srowen
Copy link
Member

srowen commented Nov 2, 2016

This was all merged to master, meaning 2.1.x

@n-marion
Copy link
Contributor

n-marion commented Nov 2, 2016

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
Member

srowen commented Nov 2, 2016

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
Contributor

n-marion commented Nov 2, 2016

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 <[email protected]>

Closes #14484 from Devian-ua/SPARK-16796.

(cherry picked from commit 14dba45)
Signed-off-by: Sean Owen <[email protected]>
Sign up for free to 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