1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Make the Conduit auth error for an unrecognized public key a little more useful

Summary: Ref T13168. This is just a small quality-of-life fix: we can disclose which public key we're talking about because public keys are public.

Test Plan:
  - Hit public key error (through my own bumbling / not reading or following instructions). Specifically, I haven't associated the key with a device in Almanac.
  - Before: vague error.
  - After: more specific error with enough key material that I could grep for it.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: yelirekim

Maniphest Tasks: T13168

Differential Revision: https://secure.phabricator.com/D19516
This commit is contained in:
epriestley 2018-07-17 16:04:00 -07:00
parent 67283c7a45
commit eb80a5ede1

View file

@ -211,9 +211,14 @@ final class PhabricatorConduitAPIController
->withIsActive(true)
->executeOne();
if (!$stored_key) {
$key_summary = id(new PhutilUTF8StringTruncator())
->setMaximumBytes(64)
->truncateString($raw_key);
return array(
'ERR-INVALID-AUTH',
pht('No user or device is associated with that public key.'),
pht(
'No user or device is associated with the public key "%s".',
$key_summary),
);
}