You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,9 +37,9 @@ All notable changes to this project will be documented in this file.
37
37
38
38
- Calibrated `wp_ajax handlers without nonce validation` detection in `dist/bin/check-performance.sh` to catch missing CSRF protection reliably:
39
39
- Replaced pipe-based `safe_file_iterator ... | while` loop with process substitution `while ...; done < <(...)` so failure flags and counters are preserved (no subshell scope loss)
40
-
-Improved handler-to-nonce coverage logic by comparing unique `wp_ajax_*` registrations to nonce checks instead of only checking whether any nonce exists in the file
40
+
-Upgraded from file-level to endpoint-level verification by mapping each `add_action('wp_ajax_*', callback)` registration to its callback and checking that callback body for `check_ajax_referer()`, `wp_verify_nonce()`, or `check_admin_referer()`
41
41
- Fixed grep-count fallback handling (`grep -c ... || true`) to avoid malformed `0\n0` values during arithmetic comparisons
42
-
- Verified against the Bloomz universal child theme case where 27 AJAX endpoints were missing nonce verification
42
+
- Verified against the Bloomz universal child theme case (issue #768 scope), where the check now reports per-endpoint missing nonce findings instead of coarse file-level flags
43
43
44
44
- N+1 pattern findings now include the actual source code line in the report. Previously the `code` field was empty because `find_meta_in_loop_line` only returned the line number without extracting the source text
# Build endpoint map: normalize wp_ajax_nopriv_* to wp_ajax_* and pair it with callback.
4490
+
# This allows endpoint-level verification instead of file-level nonce counting.
4491
+
endpoint_rows=""
4492
+
while IFS= read -r match;do
4493
+
[ -z"$match" ] &&continue
4494
+
lineno="${match%%:*}"
4495
+
code="${match#*:}"
4462
4496
4463
-
if [ "${nonce_count:-0}"-ge"$sufficient_nonces" ];then
4464
-
continue
4465
-
fi
4497
+
action=$(echo "$code"| sed -nE "s/.*add_action[[:space:]]*\([[:space:]]*['\"](wp_ajax_[^'\"]+)['\"][[:space:]]*,.*/\1/p")
4498
+
callback_name=$(echo "$code"| sed -nE "s/.*add_action[[:space:]]*\([[:space:]]*['\"]wp_ajax_[^'\"]+['\"][[:space:]]*,[[:space:]]*['\"]([^'\"]+)['\"].*/\1/p")
4466
4499
4467
-
if should_suppress_finding "wp-ajax-no-nonce""$file";then
4468
-
continue
4469
-
fi
4500
+
if [ -z"$callback_name" ];then
4501
+
callback_name=$(echo "$code"| sed -nE "s/.*\[[^,]*,[[:space:]]*['\"]([^'\"]+)['\"].*/\1/p")
4502
+
fi
4503
+
if [ -z"$callback_name" ];then
4504
+
callback_name=$(echo "$code"| sed -nE "s/.*array[[:space:]]*\([^,]*,[[:space:]]*['\"]([^'\"]+)['\"].*/\1/p")
4505
+
fi
4506
+
4507
+
[ -z"$action" ] &&continue
4508
+
normalized_action=$(echo "$action"| sed 's/^wp_ajax_nopriv_/wp_ajax_/')
0 commit comments