From b91fb4f620958e7dd40f55fb6f35b0f2154c5b82 Mon Sep 17 00:00:00 2001 From: Xristopher Anderton Date: Tue, 17 Sep 2024 15:20:29 -0700 Subject: [PATCH 1/6] adds documentation for sniff --- .../PHP/DiscouragedPHPFunctionsStandard.xml | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml diff --git a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml new file mode 100644 index 0000000000..1abafcb40d --- /dev/null +++ b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From d12e715b64b85d4cc9b2e74f178d792e47ff07a1 Mon Sep 17 00:00:00 2001 From: Jason Kenison Date: Tue, 26 Aug 2025 11:03:56 -0700 Subject: [PATCH 2/6] updated formatting, indentation, add tags --- WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml index 1abafcb40d..9c2b18ac45 100644 --- a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml +++ b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml @@ -105,4 +105,4 @@ eval( base64_decode( $code_str ) ); ]]> - \ No newline at end of file + From 46f08e38a3ad861dd21a72c50f785ad2d01e99e7 Mon Sep 17 00:00:00 2001 From: Jason Kenison Date: Tue, 26 Aug 2025 11:09:20 -0700 Subject: [PATCH 3/6] update indentation, add , linebreak end of document --- .../PHP/DiscouragedPHPFunctionsStandard.xml | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml index 9c2b18ac45..26d5511e49 100644 --- a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml +++ b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml @@ -10,33 +10,33 @@ Use JSON instead of serialized data, which has known vulnerability problems with - json_encode( $array ); +$serialized = wp_json_encode( $array ); +$unserialized = json_decode( $array ); ]]> - serialize( $array ); +$unserialized = unserialize( $array ); ]]> - - rawurlencode( get_site_url() ); ]]> - urlencode( get_site_url() ); ]]> @@ -47,12 +47,12 @@ Avoid using functions which change configuration values at runtime. - - - - - + + - - - + + - - + + + ]]> @@ -101,7 +101,7 @@ base64_decode( $expected_md5 ); eval( base64_decode( $code_str ) ); ]]> From a8fffd4508871b17ff50cc73c51afd0af0394289 Mon Sep 17 00:00:00 2001 From: Jason Kenison Date: Tue, 26 Aug 2025 14:01:34 -0700 Subject: [PATCH 4/6] include more details in obfuscate code standard --- .../Docs/PHP/DiscouragedPHPFunctionsStandard.xml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml index 26d5511e49..edbf1ce73f 100644 --- a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml +++ b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml @@ -95,13 +95,18 @@ Functions often used for obfuscating code are strongly discouraged. Make sure th eval( base64_decode( $code_str ) ); +eval( base64_decode( $code_str ) ); +eval( convert_uudecode( $uuencoded ) ); +eval( str_rot13( $rot13_encoded ) ); ]]> From b5a58721e7df297e9ed4bfc81c7832ed0558f955 Mon Sep 17 00:00:00 2001 From: Jason Kenison Date: Sun, 14 Sep 2025 10:39:40 -0700 Subject: [PATCH 5/6] requested changes --- .../PHP/DiscouragedPHPFunctionsStandard.xml | 48 ++++++------------- 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml index edbf1ce73f..e1360e9032 100644 --- a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml +++ b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml @@ -5,27 +5,26 @@ > - + json_encode( $array ); -$serialized = wp_json_encode( $array ); -$unserialized = json_decode( $array ); +$serialized = wp_json_encode( $my_array ); +$unserialized = json_decode( $my_array ); ]]> serialize( $array ); -$unserialized = unserialize( $array ); +$serialized = serialize( $my_array ); +$unserialized = unserialize( $my_array ); ]]> @@ -42,7 +41,7 @@ URLs should now be encoded using rawurlencode(). Only legacy applications should @@ -53,21 +52,13 @@ Avoid using functions which change configuration values at runtime. apache_setenv( $variable, $value ); ]]> @@ -78,35 +69,26 @@ Do not use PHP system calls. They are often disabled by server admins. exec( $my_command ); ]]> eval( base64_decode( $code_str ) ); -eval( convert_uudecode( $uuencoded ) ); -eval( str_rot13( $rot13_encoded ) ); +convert_uudecode( $uuencoded )em>; +str_rot13( $rot13_encoded ); ]]> From 013e0d0291b2fd555f099da12d15cc15dd0067ce Mon Sep 17 00:00:00 2001 From: Jason Kenison Date: Sun, 14 Sep 2025 10:44:33 -0700 Subject: [PATCH 6/6] fix spelling error --- WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml index e1360e9032..92138d542f 100644 --- a/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml +++ b/WordPress/Docs/PHP/DiscouragedPHPFunctionsStandard.xml @@ -81,7 +81,7 @@ $unserialized = unserialize( $my_array );