Skip to content

TNZ-97934: Redact api_password and TLS private key from JSON-serialized config#118

Merged
abg merged 1 commit into
mainfrom
ai-scan/TNZ-97934-logs-record-pw-and-key
Jun 30, 2026
Merged

TNZ-97934: Redact api_password and TLS private key from JSON-serialized config#118
abg merged 1 commit into
mainfrom
ai-scan/TNZ-97934-logs-record-pw-and-key

Conversation

@kimago

@kimago kimago commented Jun 23, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds MarshalJSON to config.API and config.SwitchboardApiTLS so that lager's JSON encoding of the config struct on validation failure (cmd/proxy/main.go:36) emits [REDACTED] instead of plaintext secrets
  • API.Password and SwitchboardApiTLS.PrivateKey are redacted; all other fields (including the public Certificate) are preserved
  • Adds unit tests for the redaction logic (config/config_test.go)
  • Adds an integration test that confirms the compiled proxy binary does not leak the password or PEM private key in its fatal log output when startup validation fails (cmd/proxy/main_test.go)

Jira

https://vmw-jira.broadcom.net/browse/TNZ-97934

Once this PR is accepted, transition TNZ-97934 to "Fixed".

Test plan

  • ginkgo ./config/ — 5 new redaction unit tests pass, all 40 config specs green
  • ginkgo ./cmd/proxy/ — new validation-failure integration test passes, full suite green
  • Confirm log output on a validation failure no longer contains Password or PRIVATE KEY in the data.config field

🤖 Generated with Claude Code

@abg abg left a comment

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.

I would just omit the config from the proxy main log line rather than jump through all these hoops.

Seems of no real value to print the full config.

@kimago

kimago commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

I kind of agree -- my concern is maybe the config dump has diagnostic or other value in non-obvious situations; it's already dumped, after all, only for reasons I'm not clearly seeing. So, I aimed to minimally change that output.

Old switchboard proxy logic would log the config value when loading the
configuration failed. This could leak sensitive credentials
unnecessarily.

Align with the pattern in other components and only log an error value
for troubleshooting rather than the full value.

[TNZ-97934]
ai-assisted=yes
@abg
abg force-pushed the ai-scan/TNZ-97934-logs-record-pw-and-key branch from c87becc to 5584b8b Compare June 30, 2026 22:00
@abg

abg commented Jun 30, 2026

Copy link
Copy Markdown
Member

Per discussion, simplified this to just drop logging the config value which addresses the original concern with minimal code churn.

@abg
abg merged commit c9a7f52 into main Jun 30, 2026
5 checks passed
@abg
abg deleted the ai-scan/TNZ-97934-logs-record-pw-and-key branch June 30, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants