-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat(auth): allow passwords with empty usernames #10088
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request allows the use of empty usernames when authenticating against a repository. This is done by storing the password in the keyring with a special username if the username is empty. This change also updates the documentation to reflect this change. Sequence diagram for password retrieval with empty usernamesequenceDiagram
participant Client
participant PasswordManager
participant Keyring
Client->>PasswordManager: get_password(name, username='')
alt username is empty
PasswordManager->>Keyring: get_password(name, '__poetry_source_empty_username__')
else username is not empty
PasswordManager->>Keyring: get_password(name, username)
end
Keyring-->>PasswordManager: password
PasswordManager-->>Client: password
Class diagram for password manager changesclassDiagram
class PoetryKeyring {
-_namespace: str
-_EMPTY_USERNAME_KEY: str
+get_credential(name: str, username: str)
+get_password(name: str, username: str)
+set_password(name: str, username: str, password: str)
+delete_password(name: str, username: str)
}
note for PoetryKeyring "Added _EMPTY_USERNAME_KEY constant
Modified methods to handle empty usernames"
class HTTPAuthCredential {
+username: str
+password: str
}
note for HTTPAuthCredential "Now accepts empty username"
Flow diagram for password handling logicflowchart TD
A[Start] --> B{Username empty?}
B -->|Yes| C[Use _EMPTY_USERNAME_KEY]
B -->|No| D[Use provided username]
C --> E[Store/retrieve password in keyring]
D --> E
E --> F[Return result]
F --> G[End]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @abn - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Deploy preview for website ready! ✅ Preview Built with commit 6a49590. |
This change largely reverts the decision made in b544ed5 as it seems that it is commonplace, albeit not best practice, for private indices to require or document that users use an empty username. The change in behaviour seems to surprise users migrating from 1.x (python-poetry#10085).
8de076b
to
6a49590
Compare
This change largely reverts the decision made in b544ed5 as it seems that it is commonplace, albeit not best practice, for private indices to require or document that users use an empty username. The change in behaviour seems to surprise users migrating from 1.x (#10085).
Summary by Sourcery
Allow empty usernames for private repositories.
Bug Fixes:
Enhancements: