-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
we need use format as 'git clone https://oauth2:<token>@gitea.com/u… #10902
Conversation
…ername/testcode.git' to clone code ,and failure occurred in the process!
Codecov Report
@@ Coverage Diff @@
## master #10902 +/- ##
==========================================
+ Coverage 43.40% 43.45% +0.05%
==========================================
Files 593 593
Lines 83343 83355 +12
==========================================
+ Hits 36175 36225 +50
+ Misses 42673 42641 -32
+ Partials 4495 4489 -6
Continue to review full report at Codecov.
|
I don't understand how this could be helpful. Let's take a look at the code: Lines 170 to 247 in 73cf0e2
First of all, L171 checks if the password is empty or equals the special string L178 checks if this L189-L218 allows local tokens to override oauth tokens but they're almost never going to collide. At L220 if you have successfully looked up an oauth user at L178 authUser will not be nil - so these sections will not be used - if not your change makes no difference as |
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.
This cannot be helpful. In this case the Username is not the Token the Password is the token.
We use a different format ,like gitlab use token clone code " git clone https://oauth2:[email protected]/vendor/pac...",
In order to be compatible with this way of use ;I recommend that when the username field is identified as 'oauth2',
Determines that the current request is to use ACCESS TOKEN clone code
…------------------ 原始邮件 ------------------
发件人: "zeripath"<[email protected]>;
发送时间: 2020年3月31日(星期二) 晚上6:00
收件人: "go-gitea/gitea"<[email protected]>;
抄送: "像风一样飞翔"<[email protected]>;"Author"<[email protected]>;
主题: Re: [go-gitea/gitea] we need use format as 'git clone https://oauth2:<token>@gitea.com/u… (#10902)
@zeripath requested changes on this pull request.
This cannot be helpful. In this case the Username is not the Token the Password is the token.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
It already does that. Your PR does nothing to change that. |
If the password is an oauth token the username can be absolutely anything AFAIC from that code. |
Thank you for your response ,and you can see at len 171 if authPasswd mismatch condition ,isUsernameToken Will always be false;
at len 191 because isUsernameToken is false , token will not be used
…------------------ 原始邮件 ------------------
发件人: "zeripath"<[email protected]>;
发送时间: 2020年3月31日(星期二) 晚上6:12
收件人: "go-gitea/gitea"<[email protected]>;
抄送: "像风一样飞翔"<[email protected]>;"Author"<[email protected]>;
主题: Re: [go-gitea/gitea] we need use format as 'git clone https://oauth2:<token>@gitea.com/u… (#10902)
If the password is an oauth token the username can be absolutely anything AFAIC from that code.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
When authUsername is 'oauth2' isUsernameToken will be changed to true. and token will be used;
…------------------ 原始邮件 ------------------
发件人: "zeripath"<[email protected]>;
发送时间: 2020年3月31日(星期二) 晚上6:12
收件人: "go-gitea/gitea"<[email protected]>;
抄送: "像风一样飞翔"<[email protected]>;"Author"<[email protected]>;
主题: Re: [go-gitea/gitea] we need use format as 'git clone https://oauth2:<token>@gitea.com/u… (#10902)
If the password is an oauth token the username can be absolutely anything AFAIC from that code.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Thank you for your response ,and you can see at len 171 if authPasswd mismatch condition ,isUsernameToken Will always be false; |
When authUsername is 'oauth2' isUsernameToken will be changed to true. and token will be used; |
I suggest you take another look. |
I accept your opinion,but when we use 'https://oauth2:[email protected]/vendor/pac...' to clone code ,The system returns an exception in 198L, the query fails because the authUsername is 'oauth2' ; it will not continue to execute to 220L. |
…ername/testcode.git' to clone code ,and failure occurred in the process!
I have changed the modification method, please have a look,thank you~~ |
…ername/testcode.git' to clone code ,and failure occurred in the process!
OK, So if I understand correctly - you're not talking about an external OAUTH2 token - but rather tokens that Gitea creates? Here you're suggesting relaxing the constraint that Gitea's tokens require you to login with the username and a valid token for that username? |
That's right. I agree with you completely. |
I think better compatibility will extend the life of the software,I recommend that you support additional ways to clone code,This is also the purpose of my modification |
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 could pass token as http://[email protected]/api/v1/version
with no password currently, and as such I am hesitant to include this change.
Under the current logic, you can only support clone code with a token at the username location;And I think it is necessary to recognize the token in the password position, which will improve our compatibility and user experience;Just like the scene, we now use is http://oauth2:[email protected]/api/v1/version to clone code |
I recommend that you consider supporting tokens in the password position |
We do - but with the correct username. That's what @techknowlogick was saying above. Would it be possible to explain why you have the fake username oauth2? Is this fake username provided from some other thing? I guess we could add another option but it we're loathe to end-up with an explosion of options. Do Github/Bitbucket/Gitlab do this? |
I honestly don't want to be awkward just want to do the correct thing. |
I agree with you,this form like ’http://oauth2:[email protected]/api/v1/version‘ is used in gitlab clone code; |
This form like ’http://oauth2:[email protected]/api/v1/version‘ is used in gitlab clone code; |
OK, So looking again at our AccessToken structure - I don't think we can safely do this with our AccessTokens. The tokens are structureless and are essentially just a password - so there is no guarantee that an accesstoken is unique. They're not OAuth2 tokens. I think you need to look at how you're generating these tokens - as they're not OAuth2 tokens. You wouldn't have to change anything if you were using the OAuth2 grant system. |
So I've actually looked a bit further into this. I was mistaken slightly earlier. It would be perfectly consistent to simply remove the username check completely from the accesstoken checks. The situation we have at present is inconsistent. What I'm going to do is to put up two PRs:
Sorry to have misunderstood your requests earlier. |
It doesn't matter. Do you mean that I need to make more modifications according to the above two pr now? |
…sername/testcode.git' to clone code ,and failure occurred in the process!
Please check the following:
master
branch, pull requests on release branches are only allowed for bug fixes.You MUST delete the content above including this line before posting, otherwise your pull request will be invalid.