WordPress / WordPress/WordPress-Coding-Standards

dont require sanitization for strpos and stripos

Open
#1,691 7 comments 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

strpos and stripos also do not have to have sanitized variables, since they do not modify either (and its just useless to sanitize e.g. the HTTP_HOST when its only used in strpos)

Sniff::$unslashingSanitizingFunctions - akin how count(),... don't require sanitization as added here https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/1673

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 inspecting Sniff::$unslashingSanitizingFunctions and the related change in pull request 1673, especially how count() is excluded from sanitization checks. Confirm the existing behavior for strpos() and stripos(), then update the relevant coverage so these functions no longer require sanitized variables; done means the checks accept their use with values such as HTTP_HOST.

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.