From d3b51f55bee391814fdd1fa472ef31455fa6c096 Mon Sep 17 00:00:00 2001 From: Rohit Vasudevamurthy Date: Tue, 26 Aug 2025 16:49:15 -0400 Subject: [PATCH 1/3] Add documentation for WordPress.Security.ValidatedSanitizedInput --- .../ValidatedSanitizedInputStandard.xml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml diff --git a/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml b/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml new file mode 100644 index 0000000000..6664121000 --- /dev/null +++ b/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From d52e3b9f4dce6a1b109d200a223336e16e472915 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Mon, 9 Feb 2026 17:44:28 -0300 Subject: [PATCH 2/3] Improve ValidatedSanitizedInput documentation based on PR review - Add introductory standard block explaining what the sniff checks, using language that avoids the overloaded term "validated". - Rewrite standard descriptions to explain why each rule exists. - Add tags to highlight key parts in code examples. - Remove specific mention of XSS as the attack vector. - Focus each section on its specific error without mixing concerns. - List which superglobals require wp_unslash() in MissingUnslash section. - Use varied superglobals and sanitizing functions across code examples. - Keep code examples within 48-character column width. --- .../ValidatedSanitizedInputStandard.xml | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml b/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml index 6664121000..1db4a1357f 100644 --- a/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml +++ b/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml @@ -5,90 +5,97 @@ > - + - + {$_GET['name']}"; ]]> isset( $_POST['name'] ) ) { + $name = sanitize_text_field( + wp_unslash( $_POST['name'] ) + ); } ]]> $_POST['name'] ) +); ]]> - + sanitize_email( + wp_unslash( $_POST['email'] ) + ); } ]]> - + $_POST['email'] + ); } ]]> wp_unslash( $_SERVER['REQUEST_URI'] ) + ); } ]]> $_SERVER['REQUEST_URI'] + ); } ]]> - \ No newline at end of file + From 74036b3d4d7dff4f13753407d3610af8594a0087 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Fri, 20 Mar 2026 14:31:35 -0300 Subject: [PATCH 3/3] Apply suggestion from PR review --- .../ValidatedSanitizedInputStandard.xml | 55 ++++++++++++------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml b/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml index 1db4a1357f..01ba0502f0 100644 --- a/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml +++ b/WordPress/Docs/Security/ValidatedSanitizedInputStandard.xml @@ -5,28 +5,11 @@ > - - - - - - - {$_GET['name']}"; - ]]> - - - - @@ -35,7 +18,7 @@ echo "Hello {$_GET['name']}"; isset( $_POST['name'] ) ) { $name = sanitize_text_field( - wp_unslash( $_POST['name'] ) + wp_unslash( $_POST['name'] ) ); } ]]> @@ -56,6 +39,12 @@ $name = sanitize_text_field( sanitize_file_name( + $_FILES['upload']['name'] + ); +} + if ( isset( $_POST['email'] ) ) { $email = sanitize_email( wp_unslash( $_POST['email'] ) @@ -65,6 +54,12 @@ if ( isset( $_POST['email'] ) ) { $_FILES['upload']['name']; +} + + + if ( isset( $_POST['email'] ) ) { $email = wp_unslash( $_POST['email'] @@ -98,4 +93,26 @@ if ( isset( $_SERVER['REQUEST_URI'] ) ) { ]]> + + + + + + $name"; +} + ]]> + + + {$_GET['name']}"; + ]]> + +