Page MenuHomePhabricator

Support Free and Open Source software API clients with OAuth 2.0
Closed, ResolvedPublic

Description

"As a Developer, I want to release my API client software under a Free and Open Source software license, so that [I can empower users, follow my personal principles, and garner support from other software developers]."

(There are probably another hundred reasons someone wants to release software as FLOSS; I don't think that it's important to describe those. I'm happy to change the justification to "because I want to" if we get too hung up on the reasons.)

Our use of OAuth 2.0 client IDs needs to support FLOSS clients. They can't easily keep a client ID/client secret pair secret because the source code is available (although there are options, like providing the key at build time), so we need to have other mechanisms or flows that work.

This isn't a user story on https://www.mediawiki.org/wiki/Core_Platform_Team/Initiatives/OAuth2 , but an open question. I decided to make it a user story here so we can think of it as a problem to solve.

Event Timeline

My interpretation of RFC 6749 is that the client_id is not secret, regardless of source code license. Section 2.2 says "The client identifier is not a secret; it is exposed to the resource owner and MUST NOT be used alone for client authentication." So I'm not sure if there is any special problem we need to solve here.

My interpretation of RFC 6749 is that the client_id is not secret, regardless of source code license. Section 2.2 says "The client identifier is not a secret; it is exposed to the resource owner and MUST NOT be used alone for client authentication." So I'm not sure if there is any special problem we need to solve here.

Thanks for the note. I updated it to point out that the client ID/client secret pair needs to be kept secret, not the ID itself.

I think the state of the art is to not provide a client secret for Open Source, native, or browser-based clients. https://aaronparecki.com/oauth-2-simplified/#creating-an-app

Aklapper added a subscriber: EvanProdromou.

My understanding is that this task is mostly done, because MediaWiki nominally supports non-confidential clients now: you can indicate at consumer registration time whether a client should be confidential or not, and non-confidential clients can get an access token and make authenticated requests based on only their client ID, without using the client secret.

That said, there’s at least one remaining issue with non-confidential clients (T323855: OAuth 2.0 non-confidential clients cannot use refresh tokens), and also, MediaWiki still generates a client secret for non-confidential clients (contrary to the “state of the art” mentioned above), which is confusing: I’m seeking some clarification in T323867: Clarify use of non-confidential OAuth 2.0 clients.

Tgr subscribed.

FWIW, FLOSS is a distraction here: if you include the client secret in your application and distribute your application to users, it's not a secret anymore. Not being FLOSS just makes it slightly harder to extract. So the task should really be about supporting clients which are under the control of the user (as opposed to a web application) - "public clients", as the OAuth 2 spec calls them.

As @LucasWerkmeister says this is done though, we follow RFC 7636 and require a PKCE challenge for public clients. Minor issues are probably better discussed in separate tasks.