fix: store credential auth config fields byte-exact#2890
Merged
Conversation
Contributor
Homeboy Results —
|
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.
Summary
passwordandtextareaauth config values as opaque credentials after trimming and removing control characters, preserving percent-encoded octets and$payload segments.textfield sanitization unchanged.set-tokenaccount-data path as well.Root cause and impact
sanitize_text_field()was applied to every auth config field in both the CLI direct-connect path and the sharedexecuteSaveAuthConfig()ability path. WordPress.org session cookies are opaque credential payloads, not text input: the livewporg_traccookie was reduced from 832 to 772 bytes, with percent-encoded octets stripped (tk_or=%22https%3A%2F%2Fwww.google.com%2F%22becametk_or=httpswww.google.com) and%7Csegments inwporg_sec/wporg_logged_incorrupted. The original cookie returned curl 200; the stored corrupted cookie returned Trac 403.Approach
The provider field declaration from
get_config_fields()is now the sanitization contract:passwordandtextarea: preserve the payload byte-for-byte except boundary trimming and control-character removal.textand unknown field types: retainsanitize_text_field()behavior.The regression coverage saves and reads a password/textarea value containing
%22,%3A,%2F,%7C, and$o3$g0byte-identically; it also proves text fields remain sanitized andset-tokenpreserves opaque token data.Test evidence
php -l inc/Abilities/AuthAbilities.phpphp -l inc/Cli/Commands/AuthCommand.phpphp -l tests/Unit/Abilities/AuthAbilitiesTest.phpcomposer lint -- inc/Abilities/AuthAbilities.php inc/Cli/Commands/AuthCommand.php tests/Unit/Abilities/AuthAbilitiesTest.phpThe checkout has no PHPUnit executable, PHPUnit configuration, or Composer test script, so the WordPress unit suite is not runnable from this repository state.
AI assistance