Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull in and/or surface WPCS inline docs #56

Open
3 tasks
iandunn opened this issue Apr 28, 2021 · 0 comments
Open
3 tasks

Pull in and/or surface WPCS inline docs #56

iandunn opened this issue Apr 28, 2021 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@iandunn
Copy link
Member

iandunn commented Apr 28, 2021

WPCS has some good documentation that's exposed with --generator=Text. It includes an explanation of an error, with examples of what to do and not do. e.g.:

> phpcs ./foo.php --standard=WordPress  --generator=Text

--------------------------------------------
| WORDPRESS CODING STANDARD: SAFE REDIRECT |
--------------------------------------------

wp_safe_redirect() should be used whenever possible to prevent open redirect vulnerabilities. One of
the main uses of an open redirect vulnerability is to make phishing attacks more credible. In this
case the user sees your (trusted) domain and might get redirected to an attacker controlled website
aimed at stealing private information.

----------------------------------------- CODE COMPARISON ------------------------------------------
| Valid: Redirect can only go to allowed         | Invalid: Unsafe redirect, can be abused.        |
| domains.                                       |                                                 |
----------------------------------------------------------------------------------------------------
| wp_safe_redirect( $location );                 | wp_redirect( $location );                       |

Some ideas we could do with that:

  • include that option in our messaging to plugin authors, to make sure they know about it. that could be in the brief error reports you get without --generator=Text, and in any emails we send them, etc
  • write those kinds of docs for our custom sniffs
  • pull those docs into the Handbook

xref https://wordpress.slack.com/archives/C5VCTJGH3/p1619591353086600

@iandunn iandunn added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant