Skip to content

Commit 944b257

Browse files
author
epriestley
committedMay 31, 2022
Fix a policy issue where permissions were not properly checked when disabling global builtin queries
Summary: See <https://hackerone.com/reports/1573143>. The pathway for disabling global builtin queries is missing a policy check. Add it. Test Plan: - Accessed the "/search/delete/id/.../" URI for a global builtin query as a non-administrator. - Before patch: could improperly disable queries. -After patch: proper policy exception. Differential Revision: https://secure.phabricator.com/D21851
1 parent 3052ed1 commit 944b257

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎src/applications/search/controller/PhabricatorSearchDeleteController.php

+13
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ public function handleRequest(AphrontRequest $request) {
4242
}
4343

4444
$named_query = $engine->getBuiltinQuery($key);
45+
46+
// After loading a global query, make sure the viewer actually has
47+
// permission to view and edit it.
48+
49+
PhabricatorPolicyFilter::requireCapability(
50+
$viewer,
51+
$named_query,
52+
PhabricatorPolicyCapability::CAN_VIEW);
53+
54+
PhabricatorPolicyFilter::requireCapability(
55+
$viewer,
56+
$named_query,
57+
PhabricatorPolicyCapability::CAN_EDIT);
4558
}
4659

4760
$builtin = null;

0 commit comments

Comments
 (0)
Failed to load comments.