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

EscapeOutput: improve the error message for non-escaped variables #1776

Merged
merged 1 commit into from Jul 23, 2019

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jul 23, 2019

This improved the error message output when array variables are being accessed.

echo $strings['update-available'];

Old output:
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$strings'.

New output:
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$strings['update-available']'.

No unit tests added as the unit tests don't test the message thrown.

The effect can be tested & confirmed though by running the sniff over the above code snippet.

Partially fixes #749

This improved the error message output when array variables are being accessed.

```php
echo $strings['update-available'];
```

**Old output:**
`All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$strings'.`

**New output:**
`All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$strings['update-available']'.`

No unit tests added as the unit tests don't test the message thrown.

The effect can be tested & confirmed though by running the sniff over the above code snippet.

Partially fixes 749
@dingo-d dingo-d merged commit e65086e into develop Jul 23, 2019
@jrfnl jrfnl deleted the feature/escape-output-improve-error-msg-variables branch July 23, 2019 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XSS: Issues with code snippet in error
3 participants