1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 03:12:41 +01:00
phorge-phorge/src/applications/oauthserver/controller
epriestley 7176240717 Whitelist controllers which can receive a 'code' parameter
Summary:
Ref T4593. There are a variety of clever attacks against OAuth which involve changing the redirect URI to some other URI on the same domain which exhibits unexpected behavior in response to an OAuth request. The best approach to dealing with this is for providers to lock to a specific path and refuse to redirect elsewhere, but not all providers do this.

We haven't had any specific issues related to this, but the anchor issue in T4593 was only a step away.

To mitigate this in general, we can reject the OAuth2 `'code'` parameter on //every// page by default, and then whitelist it on the tiny number of controllers which should be able to receive it.

This is very coarse, kind of overkill, and has some fallout (we can't use `'code'` as a normal parameter in the application), but I think it's relatively well-contained and seems reasonable. A better approach might be to whitelist parameters on every controller (i.e., have each controller specify the parameters it can receive), but that would be a ton of work and probably cause a lot of false positives for a long time.

Since we don't use `'code'` normally anywhere (as far as I can tell), the coarseness of this approach seems reasonable.

Test Plan:
  - Logged in with OAuth.
  - Hit any other page with `?code=...` in the URL, got an exception.
  - Grepped for `'code'` and `"code"`, and examined each use to see if it was impacted.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: aran, epriestley

Maniphest Tasks: T4593

Differential Revision: https://secure.phabricator.com/D8499
2014-03-12 11:30:04 -07:00
..
client Apply lint rules to Phabricator 2013-02-19 13:33:10 -08:00
clientauthorization Apply lint rules to Phabricator 2013-02-19 13:33:10 -08:00
PhabricatorOAuthServerAuthController.php Initialize used variable 2013-07-09 21:55:27 -07:00
PhabricatorOAuthServerController.php Remove spacer from sidebars. 2013-01-13 08:17:12 -08:00
PhabricatorOAuthServerTestController.php Delete license headers from files 2012-11-05 11:16:51 -08:00
PhabricatorOAuthServerTokenController.php Whitelist controllers which can receive a 'code' parameter 2014-03-12 11:30:04 -07:00