Skip to content

Commit 12341e4

Browse files
author
epriestley
committed
Forbid disabled devices from authenticating via SSH or HTTP
Summary: Ref T13641. Phabricator sometimes makes intracluster requests that authenticate as a device. Forbid these requests from authenticating as a disabled device. Test Plan: - Ran `bin/ssh-exec --phabricator-ssh-device ...` as an enabled/disabled device (worked; sensible error). - Made Conduit calls as an enable/disabled device (worked; sensible error). Maniphest Tasks: T13641 Differential Revision: https://secure.phabricator.com/D21635
1 parent 3267859 commit 12341e4

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

scripts/ssh/ssh-exec.php

+8
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@
146146
$device_name));
147147
}
148148

149+
if ($device->isDisabled()) {
150+
throw new Exception(
151+
pht(
152+
'This request has authenticated as a device ("%s"), but this '.
153+
'device is disabled.',
154+
$device->getName()));
155+
}
156+
149157
// We're authenticated as a device, but we're going to read the user out of
150158
// the command below.
151159
$is_cluster_request = true;

src/applications/conduit/controller/PhabricatorConduitAPIController.php

+10
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ private function authenticateUser(
238238
if ($object instanceof PhabricatorUser) {
239239
$user = $object;
240240
} else {
241+
if ($object->isDisabled()) {
242+
return array(
243+
'ERR-INVALID-AUTH',
244+
pht(
245+
'The key which signed this request is associated with a '.
246+
'disabled device ("%s").',
247+
$object->getName()),
248+
);
249+
}
250+
241251
if (!$stored_key->getIsTrusted()) {
242252
return array(
243253
'ERR-INVALID-AUTH',

0 commit comments

Comments
 (0)