WordPress / WordPress/WordPress-Coding-Standards

Calling ctype_alnum should count as sanitized input

Open
#2,016 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

if ( !empty( $_POST['hello'] ) && ctype_alnum( $_POST['hello'] ) ) {
    $hello = $_POST['hello'];
}

Atm it's reported as WordPress.Security.ValidatedSanitizedInput

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 WordPress.Security.ValidatedSanitizedInput sniff or its tests in the WordPress-Coding-Standards repository, then reproduce the issue with the provided ctype_alnum example. Done means valid ctype_alnum checks are no longer reported as unsanitized input and existing sniff behavior remains covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.