Fix unslashed superglobal input and PHPCS/WPCS violations - #521
Open
miyanialkesh7 wants to merge 3 commits into
Open
Fix unslashed superglobal input and PHPCS/WPCS violations#521miyanialkesh7 wants to merge 3 commits into
miyanialkesh7 wants to merge 3 commits into
Conversation
Wraps $_REQUEST and $_SERVER values with wp_unslash() before sanitization in acf_request_args(), acf_request_arg(), and acf_get_current_url(), addressing WordPress.Security.ValidatedSanitizedInput.MissingUnslash. Also applies phpcbf auto-fixes for minor WPCS formatting violations.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Replaces an inconsistent :text() CSS pseudo-class combo with the hasText locator option already used by the neighboring restorePostType() helper for the same row-selection task.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ran
composer lint:php(PHPCS/WPCS) against the plugin source and fixed the issues found:$_REQUESTand$_SERVERsuperglobal values were used before being unslashed, which tripsWordPress.Security.ValidatedSanitizedInput.MissingUnslash. WordPress adds slashes to all superglobal data (wp_magic_quotes()), so withoutwp_unslash()first, sanitizers likewp_kses()can leave stray backslashes in stored/output values for any input containing a quote or backslash character. Fixed in:acf_request_args()andacf_request_arg()inincludes/acf-helper-functions.php($_REQUEST)acf_get_current_url()inincludes/acf-helper-functions.php($_SERVER['HTTP_HOST'],$_SERVER['REQUEST_URI'])phpcbfauto-fixes for minor coding-standard violations inincludes/admin/views/tools/tools.php,includes/rest-api/acf-rest-api-functions.php, andincludes/rest-api/class-acf-rest-embed-links.php(whitespace/alignment only, no logic changes).Scope note: a full-repo PHPCS scan turned up a large amount of pre-existing style/doc-comment debt (thousands of violations across ~180 files, mostly
Generic.Commenting.DocComment.ShortNotCapital, missing method visibility, Yoda conditions, etc.). That's left untouched here since it's unrelated to security and would be a huge, hard-to-review diff — happy to open a separate, narrower follow-up if maintainers want that cleaned up incrementally.Closes
Use of AI Tools
This PR was prepared with the assistance of Claude Code (Anthropic). The PHPCS/WPCS scan was run and reviewed, the
wp_unslash()fixes were written and verified (syntax check + targeted PHPCS re-scan) with AI assistance, and thephpcbfauto-fix output was reviewed before committing. All changes were reviewed by me before submission.