Strip newlines from token file#6529
Closed
nicktimko wants to merge 1 commit intojupyter:6.5.xfrom
Closed
Conversation
It's common for text editors and shell redirection to generate a file that ends in a newline, which is then extremely difficult, if not impossible, to enter into the browser.
Member
It's now in jupyter-server: https://github.com/jupyter-server/jupyter_server/blob/0c22000f6ba01c1cd0de64ffa748cc869c3abf5c/jupyter_server/auth/identity.py#L202 Maybe a warning when token contains whitespaces could be a good idea? I would suggest opening an issue over at jupyter-server to discuss. |
Member
|
Closing as addressed in Jupyter Server. Thanks all! |
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.
It's common for text editors and shell redirection to generate a file that ends in a newline, which is then extremely difficult, if not impossible, to enter into the browser. After a...while...debugging, I realized that in generating my token file with
There's that trailing
0a, or\n. I hot-hacked on an all-encompassing.strip()onto my local Jupyter, but just stripping\n\ris probably the most conservative. If a user really hates themselves, they can put tabs in there, or a newline in the middle.Theoretically, this is a breaking change, but if that's the case, then I'd like to know how to get a newline in a browser's password field. 7.x/main branch seems to have radically refactored code, so I don't know where this logic is there.
If this was new, I'd probably have examined the token string and either raised a warning or just flat out refuse to start if it's a multiline string, e.g. if someone tried to generate a token but the generation failed for some reason and the file was just a traceback.