Automattic / Automattic/VIP-Coding-Standards
Consider wpcom_vip_get_resized_remote_image_url() as auto-escaping if fourth argument is truthy
- 主要言語
- PHP
- スター
- 261
- フォーク
- 44
- 平均マージ
- 19分
- マージ済み PR(30日)
- 1
説明
## Bug Description
The VIP Go standard uses `WordPress.Security.EscapeOutput.OutputNotEscaped` but doesn't recognize that the deprecated [`wpcom_vip_get_resized_remote_image_url()` function](https://github.com/Automattic/vip-go-mu-plugins/blob/dfc36174ce2274def920a9ed4bf88e7d50303b35/vip-helpers/vip-deprecated.php#L1130-L1139) auto-escapes if it's fourth argument is true (default).
Since it's conditional, we can't just add an entry for it to `$customAutoEscapedFunctions` in the VIP Go ruleset (see [here](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#xss-custom-output-escaping-functions)) as otherwise it wouldn't get flagged if the fourth argument was not truthy.
## Minimal Code Snippet
```php
// Should not be flagged.
```
```php
// Should be flagged.
```
## Tested Against `master` branch?
- [x] I have verified the issue still exists in the `master` branch of VIPCS.
- [x] I have verified the issue still exists in the `develop` branch of VIPCS.
コントリビューションガイド
調査の方向性
まず、issue に記載されている VIP Go ルールセットの XSS 出力エスケープ処理と $customAutoEscapedFunctions 設定を確認し、次にリンク先の vip-deprecated.php の関数の動作を調べます。第 4 引数の条件付き処理を追加し、提示されている true/デフォルトおよび false の例で期待される警告が出力されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php, wordpress
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100