-
Notifications
You must be signed in to change notification settings - Fork 69
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
Fix security notices #8474
Fix security notices #8474
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.2 MB ℹ️ View Unchanged
|
// No need to escape here as the function called handles it. | ||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
echo \WC_Payments_Utils::esc_interpolated_html( | ||
$message, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I would've expected this to get caught because of the following lines in phpcs.xml.dist
:
woocommerce-payments/phpcs.xml.dist
Lines 73 to 77 in 9b6a7da
<rule ref="WordPress.Security.EscapeOutput"> | |
<properties> | |
<property name="customEscapingFunctions" type="array" value="WC_Payments_Utils,esc_interpolated_html" /> | |
</properties> | |
</rule> |
I wonder if we're not adding that correctly 🤔
It'd be neat if we didn't need the ignore. I'll see if I can look into this as part of #8460 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @reykjalin, good catch there and thanks for looking into it. I wasn't aware of that rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is actually an issue with the ruleset and not necessarily our config (although I think the config is wrong as well):
See WordPress/WordPress-Coding-Standards#1176 and WordPress/WordPress-Coding-Standards#2370.
I think the config is wrong based on this example.
Either way, I guess this can wait until the next time we update the PHPCS sniffs since all those issues and PRs are still open 🫠
Fixes #8468
Changes proposed in this Pull Request
Add escaping and ignore where needed.
Testing instructions
Make sure tests pass.
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge