From 767397ee14ec6f84d87f65a2f2cc8ceea99f7ac5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 10 Feb 2015 06:16:42 -0800 Subject: [PATCH] Reject objects with invalid policies instead of fataling Summary: This is correct, but the root cause of the issue isn't very clear to me. Test Plan: Poked around various pages which filter objects. Reviewers: joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11727 --- src/applications/policy/filter/PhabricatorPolicyFilter.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/applications/policy/filter/PhabricatorPolicyFilter.php b/src/applications/policy/filter/PhabricatorPolicyFilter.php index 39e71bc691..7373991fd8 100644 --- a/src/applications/policy/filter/PhabricatorPolicyFilter.php +++ b/src/applications/policy/filter/PhabricatorPolicyFilter.php @@ -411,7 +411,11 @@ final class PhabricatorPolicyFilter { $viewer = $this->viewer; $viewer_phid = $viewer->getPHID(); - $policy = $this->customPolicies[$viewer_phid][$policy_phid]; + $policy = idx($this->customPolicies[$viewer_phid], $policy_phid); + if (!$policy) { + // Reject, this policy is bogus. + return false; + } $objects = $policy->getRuleObjects(); $action = null;