WordPress / WordPress/theme-check

Escape and sanitize untrusted data [Warning]

Open
#141 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

sniffer
Dominant language
PHP
Stars
371
Forks
113
Avg merge
8m
Merged PRs (30d)
5

Description

There are a few checks that we can run that could help catch a few of the main issues.

  1. Sanitize widget settings in the update() function in the widget class e.g. $instance['example'] = $new_instance['example'];
  2. Check if $_POST, $_GET $_REQUEST are wrapped in a bracket e.g. isset( $_POST['example] ) or esc_html( $_GET['example'] )

I am sure there are a few more that will come to mind.

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 widget class's update() function and the checks that inspect $_POST, $_GET, and $_REQUEST usage. Review the listed unsanitized widget-setting and unwrapped request examples, then define the additional cases to detect. Done means the checker reliably identifies the described unsafe patterns and covers the agreed additional cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
security, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.