Skip to content

[SPARK-49104][CORE][DOCS] Document JWSFilter usage in Spark UI and REST API and rename parameter to secretKey#47596

Closed
dongjoon-hyun wants to merge 2 commits into
apache:masterfrom
dongjoon-hyun:SPARK-49104
Closed

[SPARK-49104][CORE][DOCS] Document JWSFilter usage in Spark UI and REST API and rename parameter to secretKey#47596
dongjoon-hyun wants to merge 2 commits into
apache:masterfrom
dongjoon-hyun:SPARK-49104

Conversation

@dongjoon-hyun

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

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This PR aims the following.

  • Document JWSFilter and its usage in Spark UI and REST API
    • Spark UI section of Configuration page
    • Spark Security page
    • Spark Standalone page
  • Rename the parameter key to secretKey to redact it in Spark Driver UI and Spark Master UI.

Why are the changes needed?

To apply recent new security features

Does this PR introduce any user-facing change?

No because this is a new feature of Apache Spark 4.0.0.

How was this patch tested?

Pass the CIs and manual review.

  • spark-standalone.html
    Screenshot 2024-08-03 at 22 40 53

  • security.html
    Screenshot 2024-08-03 at 22 39 00
    Screenshot 2024-08-03 at 22 39 51

  • configuration.html
    Screenshot 2024-08-03 at 22 38 07

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

No.

…REST API and rename parameter to `secretKey`
Comment thread docs/configuration.md
<tr>
<td><code>spark.redaction.regex</code></td>
<td>(?i)secret|password|token|access[.]key</td>
<td>(?i)secret|password|token|access[.]?key</td>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually, this is missed at #47392 .

*/
override def init(config: FilterConfig): Unit = {
key = Keys.hmacShaKeyFor(Decoders.BASE64URL.decode(config.getInitParameter("key")));
key = Keys.hmacShaKeyFor(Decoders.BASE64URL.decode(config.getInitParameter("secretKey")));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Currently, key can be exposed if spark.ui.filters configuration is removed mistakenly.
Screenshot 2024-08-03 at 22 02 55

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.

secretKey will be redact by Spark, right?

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.

As you make the change #47596 (comment), do we still need to change this param to secretKey?

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Could you review this, @viirya ?

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Could you review this PR, @yaooqinn ?

@HyukjinKwon

Copy link
Copy Markdown
Member

Merged to master.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you, @viirya and @HyukjinKwon .

To @viirya , yes. We need to rename key to secretKey to redact. Yes, the documentation change is about to match the code.

As you make the change #47596 (comment), do we still need to change this param to secretKey?

@dongjoon-hyun dongjoon-hyun deleted the SPARK-49104 branch August 5, 2024 00:48
@yaooqinn

yaooqinn commented Aug 5, 2024

Copy link
Copy Markdown
Member

Late LGTM

dongjoon-hyun added a commit that referenced this pull request Jun 15, 2026
…cret` with Master REST server

### What changes were proposed in this pull request?

This PR removes the standalone `Master` check-code that rejects `spark.authenticate.secret` when the Master REST server (`spark.master.rest.enabled`) is enabled.

https://github.com/apache/spark/blob/088071d869dee0cb433c5e72ba2e7851e332b391/core/src/main/scala/org/apache/spark/deploy/master/Master.scala#L138-L144

For the record, the check was introduced at Apache Spark 2.4.0. And, currently, it's outdated.
- #22071

### Why are the changes needed?

`spark.authenticate.secret` (the RPC authentication secret) and `spark.master.rest.enabled` (the standalone submission REST server) are independent concerns, but the removed check-code coupled them by failing Master startup whenever both were set.

Since Apache Spark 4.1.0, `spark.master.rest.enabled` defaults to `true`, this check-code forced any cluster using RPC authentication to disable the REST server. This is wrong. We don't need to block like this because the REST server is protected independently like the following.
- #47595 (Apache Spark 4.0.0)
- #47596
- #49894 (Apache Spark 4.1.0)

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

Previously, starting a standalone Master with `spark.authenticate.secret` set and `spark.master.rest.enabled=true` (the default) failed with an `IllegalArgumentException`. After this PR, the Master starts normally with both configured securely.

Although this is a bug fix by enabling a previous-blocked code path. So, technically there is no loss from the user perspective.

### How was this patch tested?

Added a unit test in `MasterSuite` that verifies a `Master` can be created with both `spark.master.rest.enabled=true` and `spark.authenticate.secret` set.

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

Generated-by: Claude Code (Claude Opus 4.8)

Closes #56511 from dongjoon-hyun/SPARK-57451.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Jun 15, 2026
…cret` with Master REST server

### What changes were proposed in this pull request?

This PR removes the standalone `Master` check-code that rejects `spark.authenticate.secret` when the Master REST server (`spark.master.rest.enabled`) is enabled.

https://github.com/apache/spark/blob/088071d869dee0cb433c5e72ba2e7851e332b391/core/src/main/scala/org/apache/spark/deploy/master/Master.scala#L138-L144

For the record, the check was introduced at Apache Spark 2.4.0. And, currently, it's outdated.
- #22071

### Why are the changes needed?

`spark.authenticate.secret` (the RPC authentication secret) and `spark.master.rest.enabled` (the standalone submission REST server) are independent concerns, but the removed check-code coupled them by failing Master startup whenever both were set.

Since Apache Spark 4.1.0, `spark.master.rest.enabled` defaults to `true`, this check-code forced any cluster using RPC authentication to disable the REST server. This is wrong. We don't need to block like this because the REST server is protected independently like the following.
- #47595 (Apache Spark 4.0.0)
- #47596
- #49894 (Apache Spark 4.1.0)

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

Previously, starting a standalone Master with `spark.authenticate.secret` set and `spark.master.rest.enabled=true` (the default) failed with an `IllegalArgumentException`. After this PR, the Master starts normally with both configured securely.

Although this is a bug fix by enabling a previous-blocked code path. So, technically there is no loss from the user perspective.

### How was this patch tested?

Added a unit test in `MasterSuite` that verifies a `Master` can be created with both `spark.master.rest.enabled=true` and `spark.authenticate.secret` set.

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

Generated-by: Claude Code (Claude Opus 4.8)

Closes #56511 from dongjoon-hyun/SPARK-57451.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit ff36aac)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Jun 17, 2026
…cret` with Master REST server

### What changes were proposed in this pull request?

This PR removes the standalone `Master` check-code that rejects `spark.authenticate.secret` when the Master REST server (`spark.master.rest.enabled`) is enabled.

https://github.com/apache/spark/blob/088071d869dee0cb433c5e72ba2e7851e332b391/core/src/main/scala/org/apache/spark/deploy/master/Master.scala#L138-L144

For the record, the check was introduced at Apache Spark 2.4.0. And, currently, it's outdated.
- #22071

### Why are the changes needed?

`spark.authenticate.secret` (the RPC authentication secret) and `spark.master.rest.enabled` (the standalone submission REST server) are independent concerns, but the removed check-code coupled them by failing Master startup whenever both were set.

Since Apache Spark 4.1.0, `spark.master.rest.enabled` defaults to `true`, this check-code forced any cluster using RPC authentication to disable the REST server. This is wrong. We don't need to block like this because the REST server is protected independently like the following.
- #47595 (Apache Spark 4.0.0)
- #47596
- #49894 (Apache Spark 4.1.0)

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

Previously, starting a standalone Master with `spark.authenticate.secret` set and `spark.master.rest.enabled=true` (the default) failed with an `IllegalArgumentException`. After this PR, the Master starts normally with both configured securely.

Although this is a bug fix by enabling a previous-blocked code path. So, technically there is no loss from the user perspective.

### How was this patch tested?

Added a unit test in `MasterSuite` that verifies a `Master` can be created with both `spark.master.rest.enabled=true` and `spark.authenticate.secret` set.

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

Generated-by: Claude Code (Claude Opus 4.8)

Closes #56511 from dongjoon-hyun/SPARK-57451.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit ff36aac)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 0a95243)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Jun 17, 2026
…cret` with Master REST server

### What changes were proposed in this pull request?

This PR removes the standalone `Master` check-code that rejects `spark.authenticate.secret` when the Master REST server (`spark.master.rest.enabled`) is enabled.

https://github.com/apache/spark/blob/088071d869dee0cb433c5e72ba2e7851e332b391/core/src/main/scala/org/apache/spark/deploy/master/Master.scala#L138-L144

For the record, the check was introduced at Apache Spark 2.4.0. And, currently, it's outdated.
- #22071

### Why are the changes needed?

`spark.authenticate.secret` (the RPC authentication secret) and `spark.master.rest.enabled` (the standalone submission REST server) are independent concerns, but the removed check-code coupled them by failing Master startup whenever both were set.

Since Apache Spark 4.1.0, `spark.master.rest.enabled` defaults to `true`, this check-code forced any cluster using RPC authentication to disable the REST server. This is wrong. We don't need to block like this because the REST server is protected independently like the following.
- #47595 (Apache Spark 4.0.0)
- #47596
- #49894 (Apache Spark 4.1.0)

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

Previously, starting a standalone Master with `spark.authenticate.secret` set and `spark.master.rest.enabled=true` (the default) failed with an `IllegalArgumentException`. After this PR, the Master starts normally with both configured securely.

Although this is a bug fix by enabling a previous-blocked code path. So, technically there is no loss from the user perspective.

### How was this patch tested?

Added a unit test in `MasterSuite` that verifies a `Master` can be created with both `spark.master.rest.enabled=true` and `spark.authenticate.secret` set.

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

Generated-by: Claude Code (Claude Opus 4.8)

Closes #56511 from dongjoon-hyun/SPARK-57451.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit ff36aac)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 0a95243)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit a6480c1)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Jun 17, 2026
…cret` with Master REST server

### What changes were proposed in this pull request?

This PR removes the standalone `Master` check-code that rejects `spark.authenticate.secret` when the Master REST server (`spark.master.rest.enabled`) is enabled.

https://github.com/apache/spark/blob/088071d869dee0cb433c5e72ba2e7851e332b391/core/src/main/scala/org/apache/spark/deploy/master/Master.scala#L138-L144

For the record, the check was introduced at Apache Spark 2.4.0. And, currently, it's outdated.
- #22071

### Why are the changes needed?

`spark.authenticate.secret` (the RPC authentication secret) and `spark.master.rest.enabled` (the standalone submission REST server) are independent concerns, but the removed check-code coupled them by failing Master startup whenever both were set.

Since Apache Spark 4.1.0, `spark.master.rest.enabled` defaults to `true`, this check-code forced any cluster using RPC authentication to disable the REST server. This is wrong. We don't need to block like this because the REST server is protected independently like the following.
- #47595 (Apache Spark 4.0.0)
- #47596
- #49894 (Apache Spark 4.1.0)

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

Previously, starting a standalone Master with `spark.authenticate.secret` set and `spark.master.rest.enabled=true` (the default) failed with an `IllegalArgumentException`. After this PR, the Master starts normally with both configured securely.

Although this is a bug fix by enabling a previous-blocked code path. So, technically there is no loss from the user perspective.

### How was this patch tested?

Added a unit test in `MasterSuite` that verifies a `Master` can be created with both `spark.master.rest.enabled=true` and `spark.authenticate.secret` set.

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

Generated-by: Claude Code (Claude Opus 4.8)

Closes #56511 from dongjoon-hyun/SPARK-57451.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit ff36aac)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 0a95243)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit a6480c1)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 5b84d39)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
iemejia pushed a commit to iemejia/spark that referenced this pull request Jun 17, 2026
…cret` with Master REST server

### What changes were proposed in this pull request?

This PR removes the standalone `Master` check-code that rejects `spark.authenticate.secret` when the Master REST server (`spark.master.rest.enabled`) is enabled.

https://github.com/apache/spark/blob/088071d869dee0cb433c5e72ba2e7851e332b391/core/src/main/scala/org/apache/spark/deploy/master/Master.scala#L138-L144

For the record, the check was introduced at Apache Spark 2.4.0. And, currently, it's outdated.
- apache#22071

### Why are the changes needed?

`spark.authenticate.secret` (the RPC authentication secret) and `spark.master.rest.enabled` (the standalone submission REST server) are independent concerns, but the removed check-code coupled them by failing Master startup whenever both were set.

Since Apache Spark 4.1.0, `spark.master.rest.enabled` defaults to `true`, this check-code forced any cluster using RPC authentication to disable the REST server. This is wrong. We don't need to block like this because the REST server is protected independently like the following.
- apache#47595 (Apache Spark 4.0.0)
- apache#47596
- apache#49894 (Apache Spark 4.1.0)

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

Previously, starting a standalone Master with `spark.authenticate.secret` set and `spark.master.rest.enabled=true` (the default) failed with an `IllegalArgumentException`. After this PR, the Master starts normally with both configured securely.

Although this is a bug fix by enabling a previous-blocked code path. So, technically there is no loss from the user perspective.

### How was this patch tested?

Added a unit test in `MasterSuite` that verifies a `Master` can be created with both `spark.master.rest.enabled=true` and `spark.authenticate.secret` set.

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

Generated-by: Claude Code (Claude Opus 4.8)

Closes apache#56511 from dongjoon-hyun/SPARK-57451.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants