Repository navigation
fix(sv1_api): keep the authorize password and connection URL out of formatted output - #2486
Open
amartya1523 wants to merge 3 commits into
Open
amartya1523 wants to merge 3 commits into
amartya1523 wants to merge 3 commits into
Conversation
StandardRequest and Notification printed their params as received, so logging a mining.authorize showed its password, and logging a mining.configure showed info.connection-url, which can embed user:password@. Add redact_params, which replaces those values with <redacted>, and use it in the Display and Debug impls of both types. Other methods keep their params as is.
…ebug
Authorize redacted its password in Display but derived Debug, and Error
formats wrapped messages with {:?}. InfoParams printed the connection
URL through Configure's Debug and Display, which IsServer logs on every
mining.configure. Parse errors of mining.authorize and mining.configure
also kept the raw params.
Write Debug for Authorize and InfoParams by hand, and redact the params
kept in those parse errors.
Only Display and Debug output changes, so sv1_api takes a patch bump.
amartya1523
force-pushed
the
fix/sv1-redact-credentials
branch
from
November 6, 2026 14:47
c368226 to
15ccc10
Compare
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.
Closes #2473.
The authorize password and the
info.connection-urlfrommining.configure(which can carryuser:password@) reached formatted output in four ways:Authorizeredacted the password inDisplaybut derivedDebug, andErrorformats wrapped messages with{:?}(InvalidReceiver,Method).StandardRequest/Notificationprintedparamsas received in bothDisplayandDebug.MethodError::ParsingMethodErrorkeeps the rawMessage, so every parse error of these two methods printed them.ParsingMethodError::WrongArgs/ValueNotAnArraykept the raw authorize params, and configure'sValueNotAnArraykept the raw configure params.InfoParamsderivedDebug, whichConfigure'sDebugandDisplayboth use, andIsServerlogsdebug!("{:?}", configure)on every configure.Commit 1: raw requests.
json_rpc::redact_params(method, params)replaces the credentials a request formethodcan carry with<redacted>. Formining.authorizethat is every param after the worker name, or the whole value ifparamsis not an array. Formining.configureit is anyinfo.connection-urlfield. Other methods are borrowed untouched, so formattingmining.notifyand friends allocates nothing new.StandardRequestandNotificationuse it inDisplayand in a hand-writtenDebugwith the same shape as the derived one.Commit 2: typed values and parse errors.
AuthorizeandInfoParamsget hand-writtenDebugimpls that print<redacted>. The two authorize parse errors and the configure one keep redacted params instead of the raw ones.Commit 3:
sv1_api7.0.0 → 7.0.1. Only formatting changes; the helper ispub(crate).What stays visible: the worker name, hw/sw version and hw id, and every other method's params. Serialization (
Serialize,From<…> for Message) is unchanged, so what goes on the wire is the same.Tests:
DisplayandDebugof raw authorize requests (two params, extra params, object params,id: null) and of a configure with a connection URL contain<redacted>and not the secret.Error::InvalidReceiverwrapping anAuthorize, and theErrorfrom malformed authorize and configure requests, never contain the secret inDisplayorDebug.Both redaction tests fail if
redact_paramsis turned into a no-op.