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
+4
View File
@@ -70,6 +70,9 @@ class ScanRegion:
# its catch-all for a named function with no evidence of receiving a request. Only the scan's parameter
# rule reads it, because only it depends on whether a parameter carries request data.
entry_kind: str = ""
# The string-keyed registry call that registered this entry (`add_action`), or empty. Read by the scan's
# parameter rule alongside the dispatch facts; see `EntryPointRecord.registered_by`.
entry_registry: str = ""
def regions_for(entries: Sequence[object], targets: Sequence[object], *, shipped: frozenset[str] | None = None) -> tuple[ScanRegion, ...]:
@@ -131,6 +134,7 @@ def regions_for(entries: Sequence[object], targets: Sequence[object], *, shipped
rank=rank,
source="module_scope" if module_body else "entry_point",
entry_kind=str(getattr(entry, "kind", "") or ""),
entry_registry=str(getattr(entry, "registered_by", "") or ""),
)
# A nameless entry point IS the file. Where a named region already covers that file it adds nothing but