Skip to content

Commit e2c8a60

Browse files
noelsaw1claude
andcommitted
Fix admin-only hook whitelist: bypass group_and_add_finding flush
The grouping function's flush uses the caller's severity args, which overwrote the INFO downgrade back to HIGH. Use add_json_finding directly for whitelisted hooks to preserve the INFO severity. Verified: credit-registry-forms.php:48 now correctly reports as INFO. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e04239c commit e2c8a60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dist/bin/check-performance.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4268,9 +4268,11 @@ if [ -n "$ADMIN_MATCHES" ]; then
42684268
admin_enqueue_scripts|admin_print_styles|admin_print_scripts| \
42694269
network_admin_menu|user_admin_menu|network_admin_notices| \
42704270
admin_bar_init|admin_action_*|load-*)
4271-
# Downgrade to INFO — the hook itself implies admin context
4271+
# Downgrade to INFO — the hook itself implies admin context.
4272+
# Bypass group_and_add_finding (its flush uses the caller's
4273+
# severity, which would overwrite INFO back to HIGH).
42724274
ADMIN_SEEN_KEYS="${ADMIN_SEEN_KEYS}${key}"
4273-
group_and_add_finding "spo-004-missing-cap-check" "info" "INFO" "$file" "$lineno" "$code" "Admin-only hook '$hook_name' — implicit capability via hook context"
4275+
add_json_finding "spo-004-missing-cap-check" "info" "INFO" "$file" "$lineno" "Admin-only hook '$hook_name' — implicit capability via hook context" "$code"
42744276
continue
42754277
;;
42764278
esac

0 commit comments

Comments
 (0)