fix(scan): a hook callback's parameters are the registry's arguments, not the request's

The core-hook-argument class from the second PMPro adjudication:
pmpro_membership_history_profile_fields($user) on `edit_user_profile` was
a route entry, so its parameters were attacker input -- and $user is the
WP_User WordPress loaded; its ID became an SQL injection.

A callback registered in a string-keyed registry is handed its arguments by
the matching apply call, not by the request. The mapper now records the
registration call on the entry (`registered_by`), regions carry it, and the
dispatch fact says which registrations DO hand a callback request-borne
arguments (`request_arguments`; WordPress: add_shortcode, whose $atts are
post content). Every other registered callback keeps its call depth but
its parameters stop being sources; request data that reaches an apply
call's arguments is still followed by the hook half of the taint query.
REST routes are not registry entries and keep the parameter rule.

Controls: the fact field is validated against `register`; a hook callback
is not input, a shortcode and a plain route are.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
Marius Ciepluch
2026-09-24 09:04:42 +02:00
co-authored by Claude Opus 5.5
parent 7b8ff3cf44
commit ece4473c2b
6 changed files with 102 additions and 2 deletions
@@ -213,6 +213,10 @@ apply = ["apply_filters", "apply_filters_ref_array", "do_action", "do_action_ref
# whatever `$this` carried, and a random md5 fragment became an SQL injection.
returns = ["apply_filters", "apply_filters_ref_array"]
value_arg = 2
# A hook callback is handed its arguments by `do_action`/`apply_filters` -- a WP_User, a post id, a filtered
# value -- not by the request, so its parameters are not attacker input. A shortcode's `$atts` come from post
# content a contributor writes, which is input, so `add_shortcode` keeps the parameter rule.
request_arguments = ["add_shortcode"]
# What a PHP repository's paths say about scope. `vendored` trees are out of the scan and out of the graph
# (a bundled library is a separate unit); `tests` paths stay in scope but are not product, so their