WordPress / WordPress/WordPress-Coding-Standards

Add sniff to check that WP is killed in ajax response functions

Open
#1,206 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Extra Focus: WP interoperability Type: Enhancement
Dominant language
PHP
Stars
2.8k
Forks
521
Avg merge
5d 20h
Merged PRs (30d)
1

Description

Check that any function containing a check_ajax_referer( ... ); call, also contains a call to die(), wp_die() or exit at the end of the same function.

This should be a warning, not an error and will need a whitelist comment as the kill call may be delegated to a function which is called from within the function checking the referrer.

[Edit]: calls to wp_send_json(), wp_send_json_success() and wp_send_json_error() should also be accepted as a way to kill WP as they die.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing sniff implementations and tests for WordPress AJAX functions or referrer checks; no specific files are named in the issue. Verify that functions containing check_ajax_referer() warn unless they end with an accepted kill call, including the listed JSON helpers, while allowing a whitelist comment for delegated termination.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.