-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSH passphrases support #70
Conversation
try: | ||
state = State(child.expect([ | ||
"Permission denied", | ||
"Hi (.+)! You've successfully authenticated", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does git
always use English, even if some locale-related env vars are present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically, git uses gettext to translate it's messages:
https://github.com/git/git/blob/e5a14ddd2d93da4d951fd63d4f78fe2410debe68/Documentation/RelNotes/1.7.9.txt#L13
In practice, I don't think we've encountered this issue just yet.
lib50/authentication.py
Outdated
:return: None | ||
:type: None | ||
""" | ||
api._run(f"git credential-cache --socket {_CREDENTIAL_SOCKET} exit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this get run even if there's an exception elsewhere, just to ensure the cache is flushed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does:
Lines 191 to 194 in f4bfb94
except BaseException: | |
# Some error occured while this context manager is active, best forget credentials. | |
logout() | |
raise |
logout
is also part of the external api and is what makes this work:
check50 --logout
submit50 --logout
BTW, @Jelleas, can we detect if a user is using a password and output a message like this?
|
I don't see any way to differentiate between using a PAT and a password just yet. But, that might change past Aug 13. For now I propose we show a warning like so when HTTPS authentication fails: |
Thanks, @Jelleas! Two things I noticed:
|
|
Added the following preemptive warning as per request:
This is what the path of max warnings looks like now: |
Hey, thanks so much, @Jelleas. For consistency with the SSH wording, should we perhaps reword prompts as these?
That'll also make clearer that something has changed? And can we remove the (WARN) prefix, just so it doesn't look like an (ongoing) error? And, just to be sure, any changes still needed for Thank you!! |
Changed the phrasing and left out the WARNING prefix in 2bea4e4. I figured printing is the cleanest solution here as alternatively the logger's Quick side note, other colors are possible too. But I stuck with yellow as it stands out nicely. |
A quick draft for supporting SSH keys protected by passphrases. The student is prompted for their passphrase if needed, and they will see
*****
stars for each letter entered, just like with passwords previously. The passphrase is kept in memory with theUser
and used to:I refactored all the authentication related code to
authentication.py
, but this could use some more polish and is by no means clean just yet.Here's what a run looks like with debug log level: