WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
226999
[git-webkit] Handle auth failures
https://bugs.webkit.org/show_bug.cgi?id=226999
Summary
[git-webkit] Handle auth failures
Jonathan Bedard
Reported
2021-06-14 16:33:50 PDT
When we get a 400 error but we didn't prompt the user, we should prompt the user for credentials before giving up.
Attachments
Patch
(2.75 KB, patch)
2021-06-14 16:42 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch
(2.69 KB, patch)
2021-06-15 08:56 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Patch for landing
(5.23 KB, patch)
2021-06-15 11:37 PDT
,
Jonathan Bedard
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-06-14 16:34:13 PDT
<
rdar://problem/79313850
>
Jonathan Bedard
Comment 2
2021-06-14 16:42:14 PDT
Created
attachment 431385
[details]
Patch
Stephanie Lewis
Comment 3
2021-06-14 16:50:13 PDT
Comment on
attachment 431385
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=431385&action=review
> Tools/ChangeLog:10 > + (credentials): We should attempt to retrieve credentials, even if they
Why?
Stephanie Lewis
Comment 4
2021-06-14 16:51:36 PDT
Does getting credentials prompt? Because if so we should figure out a better way to know their required than always fetching them
dewei_zhu
Comment 5
2021-06-14 16:57:28 PDT
Comment on
attachment 431385
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=431385&action=review
> Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py:100 > + if authenticated is None and not auth and response.status_code - (response.status_code % 100) == 400:
Is `response.status_code - (response.status_code % 100) == 400` equivalent to `response.status_code // 100 == 4`?
Jonathan Bedard
Comment 6
2021-06-14 17:09:20 PDT
(In reply to dewei_zhu from
comment #5
)
> Comment on
attachment 431385
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=431385&action=review
> > > Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py:100 > > + if authenticated is None and not auth and response.status_code - (response.status_code % 100) == 400: > > Is `response.status_code - (response.status_code % 100) == 400` equivalent > to `response.status_code // 100 == 4`?
Yes. Do you prefer the `response.status_code // 100 == 4` version? No particular reason I used one over the other
Jonathan Bedard
Comment 7
2021-06-14 17:14:32 PDT
Comment on
attachment 431385
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=431385&action=review
>> Tools/ChangeLog:10 >> + (credentials): We should attempt to retrieve credentials, even if they > > Why?
Because retrieving credentials is a cheap operation. If they aren't there, we won't prompt. But we should be retrieving them (or at least trying to) even if they aren't required.
Jonathan Bedard
Comment 8
2021-06-14 17:18:43 PDT
(In reply to Stephanie Lewis from
comment #4
)
> Does getting credentials prompt? Because if so we should figure out a > better way to know their required than always fetching them
No, getting credentials does not, generally prompt. You might get a prompt for keychain if a particular credential is available, but not accessible to Python. That case should be pretty rare though, because in most cases, it's Python that put the credential there in the first place. The only case where you will get a command line prompt is the one where we don't have a credential and we need one. Right now "needing" one means that Python specifically says "hey, I need a credential to do this thing". After this patch, "needing" one means either Python specifically asked, or we got a 400 error on something.
Alexey Proskuryakov
Comment 9
2021-06-14 17:23:33 PDT
Comment on
attachment 431385
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=431385&action=review
>>> Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py:100 >>> + if authenticated is None and not auth and response.status_code - (response.status_code % 100) == 400: >> >> Is `response.status_code - (response.status_code % 100) == 400` equivalent to `response.status_code // 100 == 4`? > > Yes. Do you prefer the `response.status_code // 100 == 4` version? No particular reason I used one over the other
// looks cleaner to me. Is this script Python 3 only?
Jonathan Bedard
Comment 10
2021-06-14 17:29:01 PDT
(In reply to Alexey Proskuryakov from
comment #9
)
> Comment on
attachment 431385
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=431385&action=review
> > >>> Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py:100 > >>> + if authenticated is None and not auth and response.status_code - (response.status_code % 100) == 400: > >> > >> Is `response.status_code - (response.status_code % 100) == 400` equivalent to `response.status_code // 100 == 4`? > > > > Yes. Do you prefer the `response.status_code // 100 == 4` version? No particular reason I used one over the other > > // looks cleaner to me. Is this script Python 3 only?
Not yet, buildbot still runs it as Python 2 in a few places
Jonathan Bedard
Comment 11
2021-06-15 08:56:58 PDT
Created
attachment 431442
[details]
Patch
dewei_zhu
Comment 12
2021-06-15 10:30:24 PDT
Comment on
attachment 431442
[details]
Patch r=me
Stephanie Lewis
Comment 13
2021-06-15 10:30:47 PDT
I still don't understand why we need credentials if we say we don't need them. And your commit log should probably explain that too
Jonathan Bedard
Comment 14
2021-06-15 10:45:53 PDT
(In reply to Stephanie Lewis from
comment #13
)
> I still don't understand why we need credentials if we say we don't need > them. And your commit log should probably explain that too
It's more in the case that we don't know if we need them. Consider the case where we are grabbing a commit from a repository. We don't know in advance if that repository is private or public. If the repository is public, we don't need credentials. If it's private, we do. However, if we have credentials available (as in, we can access those credentials without prompting the user) it's better that we use the credentials. This is for two reasons: First, if we happen to be accessing a private repo, we saved ourselves a request. Second, though, is that if we're accessing a public repo with a credentialed request, that request does not count against the rate limit for your current IP address.
Jonathan Bedard
Comment 15
2021-06-15 11:37:03 PDT
Created
attachment 431458
[details]
Patch for landing
EWS
Comment 16
2021-06-15 12:05:39 PDT
Committed
r278890
(
238832@main
): <
https://commits.webkit.org/238832@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 431458
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug