Page MenuHomePhabricator

Consolidate code to check ACL membership of acting user
Open, Stalled, LowPublic

Description

Looking into non-public T373358 reminded me again that I am duplicating code, and that is no good:

./libext/misc/src/policy/WMFSecurityPolicy.php:    $trusted_project_names = ["Trusted-Contributors", "WMF-NDA", "acl*sre-team", "acl*security"];
./libext/ava/src/herald/AntiVandalismAction.php:      $trusted_project_names = ["Trusted-Contributors", "WMF-NDA", "acl*sre-team", "acl*security"];
./phabricator/src/applications/maniphest/editor/ManiphestEditEngine.php:    // ["Trusted-Contributors", "WMF-NDA", "acl*sre-team", "acl*security"];
./phabricator/src/applications/maniphest/editor/ManiphestEditEngine.php:       'PHID-PROJ-fqb3bhereyljcqrsbju7', 'PHID-PROJ-koo4qqdng27q7r65x3cw']; // acl-security
./phabricator/src/applications/maniphest/editor/ManiphestEditEngine.php:       'PHID-PROJ-fqb3bhereyljcqrsbju7', 'PHID-PROJ-koo4qqdng27q7r65x3cw']; // acl*sre_team
./phabricator/src/applications/maniphest/editor/ManiphestEditEngine.php:      ['PHID-PROJ-rte2hubdntrhiwyoau6n', 'PHID-PROJ-ibxm3v6ithf3jpqpqhl7', // trusted-contributors
./phabricator/src/applications/maniphest/editor/ManiphestEditEngine.php:      ['PHID-PROJ-rte2hubdntrhiwyoau6n', 'PHID-PROJ-ibxm3v6ithf3jpqpqhl7', // wmf-nda

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Don't duplicate code from Security extensionrepos/phabricator/phabricator!83aklapperT382034wmf/stable
Customize query in GitLab

Event Timeline

Aklapper triaged this task as Low priority.

I prefer not to have AVA depend on libext/misc for a single call (also: potential re-use outside of Wikimedia) so I'll keep a copy of getProjectByName() in src/herald/AntiVandalismAction.php.
Which leaves us with https://gitlab.wikimedia.org/repos/phabricator/phabricator/-/merge_requests/83 (though I wonder if a surrounding if (function_exists('fooo')) could be good?)

Reopening for now as I proposed https://we.phorge.it/D26738 in upstream