Repository navigation
Conversation
…d repository Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
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.
What was wrong
The site deploy webhook copies the header and footer fragments of the static site into
wp-content/uploads. Several values used by that sync came from the fetched content without being checked:data-fragment-cssanddata-fragment-jsURLs were fetched withwp_remote_get, whatever their host, so the sync could request internal addresses (private networks, loopback, cloud metadata) and store the response in a public uploads folder.../wrote the fragment files into another existing folder.repositoryfield of_deployment-info.jsonto build the GitHub API path, so the deploy token could post to another repository or endpoint.LIBRESIGN_GITHUB_WEBHOOK_SECRETwas read after the theme setting, so the secret could not be enforced from the environment.What changed
wp_safe_remote_get, and only the configured origin's host and port are allowed while the request runs, so a local static site still works in development and redirects are checked the same way.SiteFragment::language_tag()only returns tags matching^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$. Fragments are written to a staging folder and each locale folder must resolve directly inside it; the stored fragments are replaced only after every artifact has been written, and kept when the sync fails.owner/name.LIBRESIGN_GITHUB_WEBHOOK_SECRETnow takes precedence over the theme setting.Verification
mainand pass with the change.composer cigreen locally on PHP 8.3: lint, PHPCS, PHPStan, 162 unit and 174 integration tests (also with--order-by=random).pre_http_requestfilter and uploads redirected to a temporary folder. Before the change, an internal URL was fetched and stored, a crafted locale wrote outside the fragments folder, a failed write removed the stored fragments, and the comment went to the repository named in_deployment-info.json. After the change, none of these happen.