fix: redact GitHub PAT from PatBroadcastSynapse repr/str - #851
Closed
wmagev wants to merge 2 commits into
Closed
Conversation
`PatBroadcastSynapse.github_access_token` had no `repr=False` and no `__repr__` override, so `repr(synapse)` and `str(synapse)` emitted the full PAT in plaintext. Any `bt.logging.debug(synapse)` or uncaught exception traceback that included the synapse leaked every miner's PAT to logs. Mark the field with `Field(repr=False)` and override `__repr__`/`__str__` to render `***<last 4 chars>` instead. Wire format (`model_dump_json`) is unchanged so the token still transmits to validators over the axon channel.
Collaborator
|
fix ci |
Contributor
|
Any specific reason of closing it? |
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
PatBroadcastSynapse.github_access_tokenwas a vanilla pydantic field with norepr=Falseand no__repr__override, sorepr(synapse)andstr(synapse)emitted the full GitHub PAT in plaintext. Anybt.logging.debug(synapse)call, uncaught-exception traceback that included the synapse, or log-shipper that captured stdout would leak every miner's PAT to disk and downstream log infrastructure.This PR:
github_access_tokenwithField(repr=False)so pydantic's default repr excludes it.__repr__/__str__to render***<last 4 chars>(last-4 kept so operators can correlate masked log lines with rotated tokens).model_dump_json()and wire serialization unchanged — the token still transmits over the (HTTPS) axon channel.Fix #850
Before: