Page MenuHomePhabricator

ForeignWikiRequest and getFromForeign will fail if OAuth or bot passwords are in use
Open, Needs TriagePublic

Description

If a request is being made via OAuth or bot passwords, then getFromForeign and ForeignWikiRequest (used by ApiEchoUnreadNotificationPages and ApiEchoNotifications (with 'wikis' parameter other than current)) will fail.

This shouldn't cause unexpected side effects IIUC, so for now it's just "sorry, that doesn't work". But it is a limitation that will affect Tool Labs, etc. tools people might want to write. This apparently caused T140006: With some accounts but not others, API throws badsession error on OAuth options update when the transition flags were still on.

See discussion at T140127: "Can only obtain a centralauthtoken when using CentralAuth sessions" during auto-creation.

Event Timeline

We also need to be careful to avoid (if at all possible) triggering this from hooks, etc. in the future, if it could cause side effects.

Mattflaschen-WMF renamed this task from ForeignWikiRequest and getFromForeign will fail if OAuth is in use to ForeignWikiRequest and getFromForeign will fail if OAuth or bot passwords are in use.Jul 21 2016, 2:08 AM
Mattflaschen-WMF updated the task description. (Show Details)

Also when using bot passwords.

Thanks, added.

The centralauthtoken API will record a token in the central session data and use that to authenticate requests. The only way to access the central session data is via the session ID (to be more specific the session cookie contains a key which addresses the local session data, and that data includes the address of the central session data), so it cannot be done on an OAuth request (or any other request with a nonstandard authentication mechanism such as bot passwords, centralauthtoken, or some other session provider in use on some third-party wiki).

The token could be stored under a key that's computed from the user name or ID in a deterministic fashion; then it could be set up regardless of how the current request was authenticated. Not sure what the security implications of that would be. (The handling of requests from different sessions belonging to the same user would also require some thought.)