chore: mask metastore credentials in GraphConfig log output - #489
Open
eazyhozy wants to merge 2 commits into
Open
chore: mask metastore credentials in GraphConfig log output#489eazyhozy wants to merge 2 commits into
eazyhozy wants to merge 2 commits into
Conversation
Graph logs the whole GraphConfig at INFO on startup. The generated data class toString() renders every field, so the metastore user and password end up in the log in plain text. Hand-write toString() to mask just those two fields. Everything else stays visible: that log line is the primary record of how an instance was configured. An empty credential still renders as empty, so "not configured" stays distinguishable from "configured". A hand-written toString() can fall behind the constructor, so the test walks the declared fields by reflection and fails if any property stops being rendered.
…ring() The previous commit hand-wrote toString() to mask the credentials. That made the default safe, but it also pinned a 28-field rendering that has to be extended by hand every time a property is added, and a stale rendering fails silently. Move the masking to a redacted() copy and call it from the three sites that log the config. copy() keeps the generated toString(), so nothing drifts when the class grows. The trade-off is that toString() itself still renders the credentials, so a future caller that logs the config directly would leak them again.
eazyhozy
marked this pull request as ready for review
August 11, 2026 08:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Graphlogs the wholeGraphConfigat INFO on startup, and the generated data classtoString()renders every field — so the metastore user and password land in the log in plain text.Before:
After:
Changes
GraphConfig.redacted()— acopy()with the two credentials masked — and call it from the three sites that log the config.****, so "not configured" stays distinguishable from "configured".metastoreUrlis left as is: credentials reach the driver through the separate user/password fields, and the URL is the most useful part of the line when diagnosing which metastore an instance is talking to.copy()keeps the generatedtoString(), so nothing has to be maintained by hand as the class grows. The trade-off is thattoString()itself still renders the credentials, so a caller that logs the config directly would leak them again.How to Test
No test included:
redacted()is a singlecopy()call, so a test would restate the implementation rather than constrain behaviour.AI Assistance