From e5947e08d389acd41ee2046fef707cc02b04fe6a Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 30 Jan 2016 16:03:13 -0800 Subject: [PATCH] Apply phutil_utf8ize() to stderr output from VCS commands prior to logging Summary: Ref T10228. Commands like `git-http-backend` can emit errors with raw bytes in the output. Sanitize these if present so we can log them in JSON format. Test Plan: Edited this into production. >_> sneaky sneaky <_< Reviewers: chad Reviewed By: chad Maniphest Tasks: T10228 Differential Revision: https://secure.phabricator.com/D15144 --- .../diffusion/controller/DiffusionServeController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/applications/diffusion/controller/DiffusionServeController.php b/src/applications/diffusion/controller/DiffusionServeController.php index 1d41d62efa..13290b9f41 100644 --- a/src/applications/diffusion/controller/DiffusionServeController.php +++ b/src/applications/diffusion/controller/DiffusionServeController.php @@ -466,7 +466,10 @@ final class DiffusionServeController extends DiffusionController { if ($err) { return new PhabricatorVCSResponse( 500, - pht('Error %d: %s', $err, $stderr)); + pht( + 'Error %d: %s', + $err, + phutil_utf8ize($stderr))); } return id(new DiffusionGitResponse())->setGitData($stdout);