Skip to content

[SPARK-58152][K8S] Avoid logging credentials in Kubernetes client config debug log#57281

Closed
dongjoon-hyun wants to merge 1 commit into
apache:masterfrom
dongjoon-hyun:SPARK-58152
Closed

[SPARK-58152][K8S] Avoid logging credentials in Kubernetes client config debug log#57281
dongjoon-hyun wants to merge 1 commit into
apache:masterfrom
dongjoon-hyun:SPARK-58152

Conversation

@dongjoon-hyun

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Log only non-sensitive fields (masterUrl, namespace, apiVersion, requestTimeout,
connectionTimeout, trustCerts) in the DEBUG log line of
SparkKubernetesClientFactory.createKubernetesClient, instead of serializing the entire fabric8
Config object with a plain ObjectMapper.

Why are the changes needed?

Config holds the API server credentials, and a plain ObjectMapper applies no masking, so the
previous line logged oauthToken, clientKeyData, caCertData, clientCertData, the basic-auth
password, and the truststore password in cleartext. (oauthToken is annotated @JsonIgnore, but
@JsonIgnoreProperties(allowGetters = true) on the class re-enables it via its getter.)
createKubernetesClient runs on both the submission client and the driver, and driver logs are
commonly collected and archived.

Does this PR introduce any user-facing change?

No. DEBUG log content only.

How was this patch tested?

Pass the CIs.

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

Generated-by: Claude Fable 5

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Could you review this PR, @peter-toth ?

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you, @peter-toth !

dongjoon-hyun added a commit that referenced this pull request Jul 15, 2026
…fig debug log

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

Log only non-sensitive fields (`masterUrl`, `namespace`, `apiVersion`, `requestTimeout`,
`connectionTimeout`, `trustCerts`) in the DEBUG log line of
`SparkKubernetesClientFactory.createKubernetesClient`, instead of serializing the entire fabric8
`Config` object with a plain `ObjectMapper`.

### Why are the changes needed?

`Config` holds the API server credentials, and a plain `ObjectMapper` applies no masking, so the
previous line logged `oauthToken`, `clientKeyData`, `caCertData`, `clientCertData`, the basic-auth
password, and the truststore password in cleartext. (`oauthToken` is annotated `JsonIgnore`, but
`JsonIgnoreProperties(allowGetters = true)` on the class re-enables it via its getter.)
`createKubernetesClient` runs on both the submission client and the driver, and driver logs are
commonly collected and archived.

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

No. DEBUG log content only.

### How was this patch tested?

Pass the CIs.

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

Generated-by: Claude Fable 5

Closes #57281 from dongjoon-hyun/SPARK-58152.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit a4dc5d9)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Jul 15, 2026
…fig debug log

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

Log only non-sensitive fields (`masterUrl`, `namespace`, `apiVersion`, `requestTimeout`,
`connectionTimeout`, `trustCerts`) in the DEBUG log line of
`SparkKubernetesClientFactory.createKubernetesClient`, instead of serializing the entire fabric8
`Config` object with a plain `ObjectMapper`.

### Why are the changes needed?

`Config` holds the API server credentials, and a plain `ObjectMapper` applies no masking, so the
previous line logged `oauthToken`, `clientKeyData`, `caCertData`, `clientCertData`, the basic-auth
password, and the truststore password in cleartext. (`oauthToken` is annotated `JsonIgnore`, but
`JsonIgnoreProperties(allowGetters = true)` on the class re-enables it via its getter.)
`createKubernetesClient` runs on both the submission client and the driver, and driver logs are
commonly collected and archived.

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

No. DEBUG log content only.

### How was this patch tested?

Pass the CIs.

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

Generated-by: Claude Fable 5

Closes #57281 from dongjoon-hyun/SPARK-58152.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit a4dc5d9)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Jul 15, 2026
…fig debug log

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

Log only non-sensitive fields (`masterUrl`, `namespace`, `apiVersion`, `requestTimeout`,
`connectionTimeout`, `trustCerts`) in the DEBUG log line of
`SparkKubernetesClientFactory.createKubernetesClient`, instead of serializing the entire fabric8
`Config` object with a plain `ObjectMapper`.

### Why are the changes needed?

`Config` holds the API server credentials, and a plain `ObjectMapper` applies no masking, so the
previous line logged `oauthToken`, `clientKeyData`, `caCertData`, `clientCertData`, the basic-auth
password, and the truststore password in cleartext. (`oauthToken` is annotated `JsonIgnore`, but
`JsonIgnoreProperties(allowGetters = true)` on the class re-enables it via its getter.)
`createKubernetesClient` runs on both the submission client and the driver, and driver logs are
commonly collected and archived.

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

No. DEBUG log content only.

### How was this patch tested?

Pass the CIs.

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

Generated-by: Claude Fable 5

Closes #57281 from dongjoon-hyun/SPARK-58152.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit a4dc5d9)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Jul 15, 2026
…fig debug log

Log only non-sensitive fields (`masterUrl`, `namespace`, `apiVersion`, `requestTimeout`,
`connectionTimeout`, `trustCerts`) in the DEBUG log line of
`SparkKubernetesClientFactory.createKubernetesClient`, instead of serializing the entire fabric8
`Config` object with a plain `ObjectMapper`.

`Config` holds the API server credentials, and a plain `ObjectMapper` applies no masking, so the
previous line logged `oauthToken`, `clientKeyData`, `caCertData`, `clientCertData`, the basic-auth
password, and the truststore password in cleartext. (`oauthToken` is annotated `JsonIgnore`, but
`JsonIgnoreProperties(allowGetters = true)` on the class re-enables it via its getter.)
`createKubernetesClient` runs on both the submission client and the driver, and driver logs are
commonly collected and archived.

No. DEBUG log content only.

Pass the CIs.

Generated-by: Claude Fable 5

Closes #57281 from dongjoon-hyun/SPARK-58152.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit a4dc5d9)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Jul 15, 2026
…fig debug log

Log only non-sensitive fields (`masterUrl`, `namespace`, `apiVersion`, `requestTimeout`,
`connectionTimeout`, `trustCerts`) in the DEBUG log line of
`SparkKubernetesClientFactory.createKubernetesClient`, instead of serializing the entire fabric8
`Config` object with a plain `ObjectMapper`.

`Config` holds the API server credentials, and a plain `ObjectMapper` applies no masking, so the
previous line logged `oauthToken`, `clientKeyData`, `caCertData`, `clientCertData`, the basic-auth
password, and the truststore password in cleartext. (`oauthToken` is annotated `JsonIgnore`, but
`JsonIgnoreProperties(allowGetters = true)` on the class re-enables it via its getter.)
`createKubernetesClient` runs on both the submission client and the driver, and driver logs are
commonly collected and archived.

No. DEBUG log content only.

Pass the CIs.

Generated-by: Claude Fable 5

Closes #57281 from dongjoon-hyun/SPARK-58152.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit a4dc5d9)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Merge Summary:

Posted by merge_spark_pr.py

@dongjoon-hyun
dongjoon-hyun deleted the SPARK-58152 branch July 15, 2026 20:01
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