print.mx_client_config(): mask token and password#12
Open
TroyHernandez wants to merge 3 commits into
Open
Conversation
An mx_client_config had no print method, so auto-printing one at the console fell through to the default list print and showed the access token and password verbatim. That is the first thing anyone does with mx_client_load(), and the values then live in scrollback, screenshots, and pasted bug reports. The method prints every field with token/password (plus access_token and refresh_token, defensively) shown as <hidden> or <unset>. sync_token is not treated as a secret: it is a cursor, and seeing it helps when debugging a stuck sync. unclass() remains the escape hatch for the rare case that needs the raw values.
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.
An
mx_client_configcarried noprintmethod, so auto-printing one atthe console fell through to the default list print and showed
tokenandpasswordin the clear:cfg <- mx_client_load(); cfgis the first thing anyone does with thispackage, and the credentials then live in scrollback, screenshots, and
pasted bug reports. The on-disk side was already careful (mode 0600); the
in-session side was not.
Now:
Notes:
sync_tokenis deliberately not masked. It is a cursor, not a secret,and seeing it is what you want when debugging a stuck sync.
access_tokenandrefresh_tokenare masked too, defensively, in casea config picked up those names elsewhere.
unclass(x)still exposes everything, which is the right escape hatch.<hidden>vs<unset>) so "is mytoken even loaded?" stays answerable without printing it.
Tests assert the secret values appear nowhere in the printed output.
R CMD checkis clean apart from the pre-existing stale-DateNOTE.