Page MenuHomePhabricator

Dead code and non-existing classes mentioned in WMFSecurityPolicy.php
Closed, ResolvedPublic

Description

Does anything still call the methods

  • getSecurityProjectForTask
  • filter_policy_transactions
  • getSecurityFieldValue

in https://gitlab.wikimedia.org/repos/phabricator/extensions/-/blob/wmf/stable/src/policy/WMFSecurityPolicy.php ?

Plus

Event Timeline

Aklapper triaged this task as Low priority.
Aklapper changed the task status from Open to Stalled.Feb 7 2025, 8:13 AM
Aklapper claimed this task.

Alright, digged deeper into this pile of Technical-Debt after finding T386458:

While I think that we can remove the dead code, I wonder if we could also stop writing these unread custom values, though simple removal of the custom field will create breakage without fixing forms like 117 (or Herald rules like T386458 might read that field, see also https://we.phorge.it/T15885).

[1] SELECT CONCAT("https://phabricator.wikimedia.org/T",t.id), csi.indexValue FROM phabricator_maniphest.maniphest_customfieldstringindex csi INNER JOIN phabricator_maniphest.maniphest_task t ON csi.objectPHID = t.phid WHERE csi.indexKey = "456XCt.DWg.X" ORDER BY t.id;
[2] SELECT CONCAT("https://phabricator.wikimedia.org/T",t.id), cfs.fieldValue FROM phabricator_maniphest.maniphest_customfieldstorage cfs INNER JOIN phabricator_maniphest.maniphest_task t ON cfs.objectPHID = t.phid WHERE cfs.fieldIndex = "456XCt.DWg.X" ORDER BY t.id;
[3] SELECT CONCAT("https://phabricator.wikimedia.org/T",t.id), csi.indexValue FROM phabricator_maniphest.maniphest_customfieldstringindex csi INNER JOIN phabricator_maniphest.maniphest_task t ON csi.objectPHID = t.phid WHERE csi.indexKey = "456XCt.DWg.X" AND indexValue != "default" ORDER BY t.id;
[4] Example: SELECT CONCAT("https://phabricator.wikimedia.org/transactions/editengine/maniphest.task/defaults/",id,"/") AS form FROM phabricator_search.search_editengineconfiguration WHERE engineKey = "maniphest.task" AND properties LIKE "%\"std:maniphest:security_topic\":\"ops-access-request\"%";

[ak@local wmfphab]$ grep -r security_topic .
./deployment/scap/templates/phabricator/conf/local/local.json.j2: "security_topic": {
./deployment/libext/misc/src/policy/WMFSecurityPolicy.php:        if ($field_key == 'std:maniphest:security_topic') {
./deployment/libext/misc/src/policy/WMFLockTaskController.php:    ->setMetadataValue('customfield:key', 'std:maniphest:security_topic')
./deployment/tools/wmfphablib/phabapi.py:                         "std:maniphest:security_topic": security})
./deployment/tools/bugzilla_create.py:                            "std:maniphest:security_topic":"%s" % (buginfo["secstate"],)})

Deployed some partial code changes in today's phabricator deployment in T386522 - see commits on Feb06-07, 2025 in https://gitlab.wikimedia.org/repos/phabricator/extensions/-/commits/wmf/stable?ref_type=heads