Some more false positive examples
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
まず、報告された PHP スニペットを再現し、出力される WordPress.Security および WordPress.NamingConventions の警告を要求された動作と比較します。nonce 検証、入力のサニタイズ、一時変数の扱いを担当するルールを追跡します。完了の条件は、有効な例と認識されたカスタム検証器でこれらの誤検知が発生しなくなることです。
索引モデルが issue の本文から書いたものです。
説明
Valid code:
function verify()
{
if (empty($_REQUEST['g-recaptcha-response'])) {
return false;
}
}
Result:
| 74 | 15 | WARNING | WordPress.Security.NonceVerification.Missing | Processing form data without nonce verification. | |
This should not be an warning as I am not doing anything with the value, just checking if it exists.
Multiple errors:
function verifyNonce($key, $action = -1)
{
if(empty($_POST[$key])){
return false;
}
return wp_verify_nonce(sanitize_text_field(wp_unslash($_POST[$key])), $action);
}
if(!verifyNonce('nonce', 'tsjippy-plugin-actions')){
?>
<div class='error'>
Invalid nonce
</div>
<?php
return;
}
if (!empty($_GET['activate'])) {
$key = 'activate';
} else {
$key = 'install';
}
$slug = sanitize_text_field(wp_unslash($_GET[$key] ?? ''));
if (!empty($_GET['install'])) {
updateOrDownloadPlugin($slug);
}
Result:
99 | 20 | WARNING | WordPress.Security.NonceVerification.Recommended | Processing form data without nonce verification.
105 | 50 | WARNING | WordPress.Security.NonceVerification.Recommended | Processing form data without nonce verification.
107 | 20 | WARNING | WordPress.Security.NonceVerification.Recommended | Processing form data without nonce verification.
I have a custom nonce verifying function, it would be great if that could be recognised.
Code:
($_GET['update'] ?? '') == $slug
Result:
589 | 18 | WARNING | WordPress.Security.NonceVerification.Recommended | Processing form data without nonce verification.
589 | 18 | WARNING | WordPress.Security.ValidatedSanitizedInput.MissingUnslash | $_GET['update'] not unslashed before sanitization. Use wp_unslash() or similar
589 | 18 | WARNING | WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | Detected usage of a non-sanitized input variable: $_GET['update']
I am hard comparing this value against another value, I don't think sanitizing is needed right?
Code:
foreach (glob( "{".__DIR__ .",".__DIR__ . "/php,".__DIR__ . "/extra/*/php}/*.php", GLOB_BRACE) as $file) {
require_once($file);
}
unset($file);
Error:
16 | 103 | WARNING | WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$file".
This temp variable is later on unset so no warning needed
- 主要言語
- PHP
- スター
- 365
- フォーク
- 135
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 20
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
WordPress/plugin-check のほかの issue
-
False positive trademarked_term warning for "wc" inside the word "Flowchart"対応中かも @anandrajaram21 が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
WordPress/plugin-check#1556 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Add opt-in .distignore exclusions for local and CI scans対応中かも @jakaria-istauk が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
WordPress/plugin-check#1559 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
WordPress/plugin-check#1557 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
WordPress/plugin-check#1555 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
PHPErrorReportingSniff flags debug constants used as values in const declarations対応中かも @elphizu が 7 日前に担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 35/100
WordPress/plugin-check#1553 ·
メンテナーはふだん 1 日以内に返信
WordPress/plugin-check の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ExpressionEngine/ExpressionEngine#5493 ·
メンテナーはふだん 5 日以内に返信
-
"Attempt to read property 'username' on null" error after a user is deleted対応中かも @dicksonlaw583 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
omeka/plugin-SimplePages#49 ·
-
not confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信