Page MenuHomePhabricator

OAuth allows creating OAuth 2 client with empty callback URL, presents it confusingly
Open, Needs TriagePublic

Description

This proposed client / consumer looks rather unusual:

image.png (569×198 px, 36 KB)

It took me a moment to realize (in fact, without T247800, I’m still not 100% sure) that the callback URL is completely empty. It’s a little bit clearer in view this consumer mode:
image.png (526×234 px, 35 KB)

I’m tempted to say that the extension should display this better (a custom warning to replace mwoauth-consumer-callbackurl-protocol?), but really, this should probably be rejected outright, right?

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Hm, as far as I can tell, this should have been rejected, both because the callbackUrl is a required field and because it must parse as a URL. But also, the URL really is completely empty in the database (checked via @Lucas_Werkmeister_WMDE’s production access):

mysql:research@dbstore1008.eqiad.wmnet [metawiki]> SELECT oarc_consumer_key FROM oauth_registered_consumer WHERE oarc_callback_url = '' LIMIT 10;
+----------------------------------+
| oarc_consumer_key                |
+----------------------------------+
| daf93620c0dd7b0aea7b2a9e40de9deb |
+----------------------------------+
1 row in set (0.023 sec)

I guess the good news is it’s the only such consumer/client in the database.

We are (since a few days ago) not setting callback URLs on owner-only and client-credentials apps since they have no purpose, but yeah it should be displayed in a more meaningful way (probably by just hiding the whole field). If you are seeing it on an app with auth code grant or an OAuth 1 app, that's a bug in app validation.

Does that mean I was wrong to reject the client/consumer?

If you are seeing it on an app with auth code grant or an OAuth 1 app, that's a bug in app validation.

The linked app has “Allowed OAuth2 grant types: Client credentials”; if that’s supposed to mean that the empty callback URL is expected, then yes please make that display a lot more meaningful.

Looking at the db row, it was a client credentials app, for which an approval process doesn't make sense. On Wikimedia wikis, it would go away with T440873. There's also T439595 which tracks removing approval process for old-style client credentials app (although I'd prefer to remove old-style client-credentials flow altogether).

I can't access the first link (can someone make me an OAuth admin? I see there's no process for it), but OAuthManageConsumers screen would need a fix to skip callback-url for client credentials apps.

We should also include a mention of the grant flow (client creds vs auth code) in the consumer details page.

Change #1354552 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/OAuth@master] OAuthManageConsumer: Hide callback url for client-credentials apps

https://gerrit.wikimedia.org/r/1354552

Change #1354968 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/OAuth@master] Auto-approve legacy client-credential apps

https://gerrit.wikimedia.org/r/1354968

Does that mean I was wrong to reject the client/consumer?

Bumping this question, because if I’ve made a mistake, I’d like to correct it…

can someone make me an OAuth admin? I see there's no process for it

People have used Babel before. You could also make a steward permission request. If those don't work, ping me and I'll find someone to do it, but it's good to have a public trace for it.

Does that mean I was wrong to reject the client/consumer?

Yeah, for client-credentials consumers, no redirect URL is fine. In the past, a consumer could have the client credentials and auth code flows at the same time, but for new approvals that shouldn't be possible anymore.

Alright, thanks, I’ve approved the client now.