print.mx_session(): mask the access token - #16
Open
TroyHernandez wants to merge 3 commits into
Open
Conversation
An mx_session had no print method, so auto-printing one at the console fell through to the default list print and showed the access token verbatim. Any call that returns a session (mx_login, mx_devices helpers, etc.) then put the token into scrollback, screenshots, and pasted bug reports. The method prints every field with token shown as <hidden> or <unset>; server, user_id, and device_id stay visible. unclass() remains the escape hatch for the rare case that needs the raw token.
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.
Companion to cornball-ai/mx.client#12, one layer down. An
mx_sessionhad no
printmethod, so auto-printing one fell through to the defaultlist print and showed the access token in the clear:
Any call that returns a session (
mx_login(), and internally themx_devices()/mx_whoami()paths that build one) then put the tokeninto scrollback, screenshots, and pasted bug reports.
Now:
tokenis masked;server,user_id,device_idstay visible.<hidden>vs<unset>keeps "is my token loaded?" answerable.unclass(x)is the escape hatch for the raw value.Tests assert the token appears nowhere in printed output; all 191 tests
pass,
R CMD checkclean apart from the pre-existing stale-DateNOTE.