Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-49197][CORE] Redact Spark Command output in launcher module #47704

Closed
wants to merge 1 commit into from

Conversation

dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Aug 12, 2024

What changes were proposed in this pull request?

This PR aims to redact Spark Command output in launcher module.

Why are the changes needed?

When launcher module shows Spark Command, there is no redaction. Although Spark Cluster is supposed to be in a secure environment, this could be collected by a centralized log system. We need to do a proper redaction.

EXAMPLE (Spark History Server)

$ SPARK_NO_DAEMONIZE=1 \
  SPARK_HISTORY_OPTS="-Dspark.ui.filters=org.apache.spark.ui.JWSFilter -Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4=" \
  sbin/start-history-server.sh

BEFORE

Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4= \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer

AFTER

...
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=*********(redacted) \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer

Does this PR introduce any user-facing change?

This only changes the log messages during startup.

How was this patch tested?

Pass the CIs with newly added test case.

Was this patch authored or co-authored using generative AI tooling?

No.

@dongjoon-hyun
Copy link
Member Author

Could you review this security patch when you have some time, @yaooqinn ?

Copy link
Member

@yaooqinn yaooqinn left a comment

Choose a reason for hiding this comment

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

+1, LGTM

@dongjoon-hyun
Copy link
Member Author

Thank you, @yaooqinn !

dongjoon-hyun added a commit that referenced this pull request Aug 12, 2024
### What changes were proposed in this pull request?

This PR aims to redact `Spark Command` output in `launcher` module.

### Why are the changes needed?

When `launcher` module shows `Spark Command`, there is no redaction. Although Spark Cluster is supposed to be in a secure environment, this could be collected by a centralized log system. We need to do a proper redaction.

**EXAMPLE (Spark History Server)**
```
$ SPARK_NO_DAEMONIZE=1 \
  SPARK_HISTORY_OPTS="-Dspark.ui.filters=org.apache.spark.ui.JWSFilter -Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4=" \
  sbin/start-history-server.sh
```

**BEFORE**
```
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4= \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

**AFTER**
```
...
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=*********(redacted) \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

### Does this PR introduce _any_ user-facing change?

This only changes the log messages during startup.

### How was this patch tested?

Pass the CIs with newly added test case.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #47704 from dongjoon-hyun/SPARK-49197.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit 93cf355)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
dongjoon-hyun added a commit that referenced this pull request Aug 12, 2024
### What changes were proposed in this pull request?

This PR aims to redact `Spark Command` output in `launcher` module.

### Why are the changes needed?

When `launcher` module shows `Spark Command`, there is no redaction. Although Spark Cluster is supposed to be in a secure environment, this could be collected by a centralized log system. We need to do a proper redaction.

**EXAMPLE (Spark History Server)**
```
$ SPARK_NO_DAEMONIZE=1 \
  SPARK_HISTORY_OPTS="-Dspark.ui.filters=org.apache.spark.ui.JWSFilter -Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4=" \
  sbin/start-history-server.sh
```

**BEFORE**
```
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4= \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

**AFTER**
```
...
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=*********(redacted) \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

### Does this PR introduce _any_ user-facing change?

This only changes the log messages during startup.

### How was this patch tested?

Pass the CIs with newly added test case.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #47704 from dongjoon-hyun/SPARK-49197.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit 93cf355)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
@dongjoon-hyun
Copy link
Member Author

Merged to master/3.5/3.4.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-49197 branch August 12, 2024 17:29
IvanK-db pushed a commit to IvanK-db/spark that referenced this pull request Sep 20, 2024
### What changes were proposed in this pull request?

This PR aims to redact `Spark Command` output in `launcher` module.

### Why are the changes needed?

When `launcher` module shows `Spark Command`, there is no redaction. Although Spark Cluster is supposed to be in a secure environment, this could be collected by a centralized log system. We need to do a proper redaction.

**EXAMPLE (Spark History Server)**
```
$ SPARK_NO_DAEMONIZE=1 \
  SPARK_HISTORY_OPTS="-Dspark.ui.filters=org.apache.spark.ui.JWSFilter -Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4=" \
  sbin/start-history-server.sh
```

**BEFORE**
```
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4= \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

**AFTER**
```
...
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=*********(redacted) \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

### Does this PR introduce _any_ user-facing change?

This only changes the log messages during startup.

### How was this patch tested?

Pass the CIs with newly added test case.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47704 from dongjoon-hyun/SPARK-49197.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
szehon-ho pushed a commit to szehon-ho/spark that referenced this pull request Sep 24, 2024
### What changes were proposed in this pull request?

This PR aims to redact `Spark Command` output in `launcher` module.

### Why are the changes needed?

When `launcher` module shows `Spark Command`, there is no redaction. Although Spark Cluster is supposed to be in a secure environment, this could be collected by a centralized log system. We need to do a proper redaction.

**EXAMPLE (Spark History Server)**
```
$ SPARK_NO_DAEMONIZE=1 \
  SPARK_HISTORY_OPTS="-Dspark.ui.filters=org.apache.spark.ui.JWSFilter -Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4=" \
  sbin/start-history-server.sh
```

**BEFORE**
```
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4= \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

**AFTER**
```
...
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=*********(redacted) \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

### Does this PR introduce _any_ user-facing change?

This only changes the log messages during startup.

### How was this patch tested?

Pass the CIs with newly added test case.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47704 from dongjoon-hyun/SPARK-49197.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
attilapiros pushed a commit to attilapiros/spark that referenced this pull request Oct 4, 2024
### What changes were proposed in this pull request?

This PR aims to redact `Spark Command` output in `launcher` module.

### Why are the changes needed?

When `launcher` module shows `Spark Command`, there is no redaction. Although Spark Cluster is supposed to be in a secure environment, this could be collected by a centralized log system. We need to do a proper redaction.

**EXAMPLE (Spark History Server)**
```
$ SPARK_NO_DAEMONIZE=1 \
  SPARK_HISTORY_OPTS="-Dspark.ui.filters=org.apache.spark.ui.JWSFilter -Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4=" \
  sbin/start-history-server.sh
```

**BEFORE**
```
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4= \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

**AFTER**
```
...
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=*********(redacted) \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

### Does this PR introduce _any_ user-facing change?

This only changes the log messages during startup.

### How was this patch tested?

Pass the CIs with newly added test case.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47704 from dongjoon-hyun/SPARK-49197.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
himadripal pushed a commit to himadripal/spark that referenced this pull request Oct 19, 2024
### What changes were proposed in this pull request?

This PR aims to redact `Spark Command` output in `launcher` module.

### Why are the changes needed?

When `launcher` module shows `Spark Command`, there is no redaction. Although Spark Cluster is supposed to be in a secure environment, this could be collected by a centralized log system. We need to do a proper redaction.

**EXAMPLE (Spark History Server)**
```
$ SPARK_NO_DAEMONIZE=1 \
  SPARK_HISTORY_OPTS="-Dspark.ui.filters=org.apache.spark.ui.JWSFilter -Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4=" \
  sbin/start-history-server.sh
```

**BEFORE**
```
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=VmlzaXQgaHR0cHM6Ly9zcGFyay5hcGFjaGUub3JnIHRvIGRvd25sb2FkIEFwYWNoZSBTcGFyay4= \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

**AFTER**
```
...
Spark Command: /Users/dongjoon/.jenv/versions/17/bin/java -cp /Users/dongjoon/APACHE/spark-merge/conf/:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/slf4j-api-2.0.14.jar:/Users/dongjoon/APACHE/spark-merge/assembly/target/scala-2.13/jars/* \
-Dspark.ui.filters=org.apache.spark.ui.JWSFilter \
-Dspark.org.apache.spark.ui.JWSFilter.param.secretKey=*********(redacted) \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer
```

### Does this PR introduce _any_ user-facing change?

This only changes the log messages during startup.

### How was this patch tested?

Pass the CIs with newly added test case.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#47704 from dongjoon-hyun/SPARK-49197.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
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.

2 participants