Github user markgrover commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15971#discussion_r89240880
  
    --- Diff: 
core/src/test/scala/org/apache/spark/scheduler/EventLoggingListenerSuite.scala 
---
    @@ -95,6 +95,30 @@ class EventLoggingListenerSuite extends SparkFunSuite 
with LocalSparkContext wit
         }
       }
     
    +  test("Event logging with password redaction") {
    +    val secretPassword = "secret_password"
    +    val conf = getLoggingConf(testDirPath, 
None).set("spark.executorEnv.HADOOP_CREDSTORE_PASSWORD",
    +      secretPassword)
    +    sc = new SparkContext("local-cluster[2,2,1024]", "test", conf)
    +    assert(sc.eventLogger.isDefined)
    +    val eventLogger = sc.eventLogger.get
    +
    +    sc.parallelize(1 to 10000).count()
    +    sc.stop()
    +
    +    val logData = EventLoggingListener.openEventLog(new 
Path(eventLogger.logPath), fileSystem)
    +    val eventLog = Source.fromInputStream(logData).mkString
    +    // Make sure nothing secret shows up anywhere
    +    assert(!eventLog.contains(secretPassword), s"Secret password 
($secretPassword) not redacted " +
    +      s"from event logs:\n $eventLog")
    +    val expected = 
""""spark.executorEnv.HADOOP_CREDSTORE_PASSWORD":"*********(redacted)""""
    +    // Make sure every occurrence of the property is accompanied by a 
redaction text.
    +    val regex = 
""""spark.executorEnv.HADOOP_CREDSTORE_PASSWORD":"([^"]*)"""".r
    +    val matches = regex.findAllIn(eventLog)
    +    assert(matches.nonEmpty)
    +    matches.foreach(matched => assert(matched.equals(expected)))
    --- End diff --
    
    Fixed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to