-
Notifications
You must be signed in to change notification settings - Fork 993
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
Removed client-side username checks (#3444) #3464
Conversation
conans/client/userio.py
Outdated
if self._interactive: | ||
self.out.write("Remote '%s' username: " % remote_name) | ||
user_input = self.get_username(remote_name) | ||
username = Username(user_input) |
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.
I am not sure about this. The implementation is:
class Username(str):
def __new__(cls, name):
"""Simple name creation.
@param name: string containing the desired name
"""
ConanName.validate_user(name)
return str.__new__(cls, name)
So it will still raise if validate_user()
pattern is not fullfilled. Sounds a test would help to make sure it is working as expected.
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.
You're right -- I got a different err msg after this change and assumed it was sent over from the server. On further inspection it's just displaying the exception message from models/ref.py.
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.
The implementation now seems correct. However, to make it a complete change, it would be necessary:
- To remove the
Username
class from the code. It is not used anywhere else, it is dead code now - To remove the
username_test
, that is testing such unused class. - A new test that proves that characters not valid in the
name
field of a conan_ref, like@
are indeed allowed now.
The first two are easy, just remove them. The last one might be a bit more complicated, but the TestClient
allows in the constructor the user
field which accepts user-password to be used in auth, that would be enough to test it. Ask for help if needed, thanks :)
Added tests and rm the dead code, let me know if this is ok :) |
Removed dead code for client-side user checks and added tests
Excellent, thank you! |
…) (#3410) * check that parameters are string before applying regex match * add tests related to ConanName * typo * update docs related to function * use six to check for string types * use a custom message to validate each field * refactor tests to validate custom messages * fix tests: message is more explicit * given #3464 this is dead code * format error message only if we are actually going to use it * minor changes: address @lasote review
* check that parameters are string before applying regex match * add tests related to ConanName * typo * update docs related to function * use six to check for string types * use a custom message to validate each field * refactor tests to validate custom messages * fix tests: message is more explicit * given #3464 this is dead code * format error message only if we are actually going to use it * minor changes: address @lasote review * optional validation of conanfile reference
Removed client-side username checks (conan-io#3444)
…an-io#3204) (conan-io#3410) * check that parameters are string before applying regex match * add tests related to ConanName * typo * update docs related to function * use six to check for string types * use a custom message to validate each field * refactor tests to validate custom messages * fix tests: message is more explicit * given conan-io#3464 this is dead code * format error message only if we are actually going to use it * minor changes: address @lasote review
* check that parameters are string before applying regex match * add tests related to ConanName * typo * update docs related to function * use six to check for string types * use a custom message to validate each field * refactor tests to validate custom messages * fix tests: message is more explicit * given conan-io#3464 this is dead code * format error message only if we are actually going to use it * minor changes: address @lasote review * optional validation of conanfile reference
Fairly simple fix I think, just removing the client side tests when authenticating with the server. An error will still be raised iff the server determines the username to be invalid, but client side checks are no longer in place. This means that it's completely at the discretion of the server to decide whether or not a username is valid or invalid.
As I mentioned in #3444, the client side checks made it impossible to authenticate with an Artifactory instance using SAML SSO using the prompts in
conan upload
. The removal of these checks should fix this. I haven't yet been able to test whether or not Artifactory will deem email addresses to be OK -- I can check this Wednesday. But I think now the onus is on Artifactory to exhibit the correct behaviour rather than any bug in conan.develop
branch, documenting this one. Also adding a description of the changes in thechangelog.rst
file. https://github.com/conan-io/docsChangelog: Fix: Removed login username syntax checks that were no longer necessary.