Automattic / Automattic/VIP-Coding-Standards
Consider wpcom_vip_get_resized_remote_image_url() as auto-escaping if fourth argument is truthy
- Vorherrschende Sprache
- PHP
- Sterne
- 261
- Forks
- 44
- Ø Merge
- 19 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
## 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.
Beitragsleitfaden
Rechercherichtung
Beginne mit der Behandlung der XSS-Ausgabe-Escaping-Regeln des VIP Go-Regelwerks und der in diesem Issue beschriebenen Konfiguration $customAutoEscapedFunctions und untersuche anschließend das Verhalten der verknüpften Funktion in vip-deprecated.php. Füge eine bedingte Behandlung für das vierte Argument hinzu und überprüfe, dass die bereitgestellten Beispiele für true/Standard und false die erwarteten Warnungen erzeugen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php, wordpress
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100