Allow symlink creation through symlinked dirs in preserve-local#134
Open
adamziel wants to merge 1 commit into
Open
Allow symlink creation through symlinked dirs in preserve-local#134adamziel wants to merge 1 commit into
adamziel wants to merge 1 commit into
Conversation
bbc4546 to
a44610b
Compare
Verify that preserve-local mode correctly handles the WP Cloud Atomic theme layout: a per-site symlink at wp-content/themes/indice (site-owned directory, no symlinks in path) pointing to ../../wordpress/themes/pub/indice (shared infrastructure, reached through a symlinked directory). The symlink is allowed because the parent directory is site-owned. The target path passes validation because assert_symlink_target_within_root uses normalize_path (string-only, no symlink resolution). Meanwhile, entries whose parent IS inside a shared directory (reached through a symlink) are blocked regardless of whether they're files or symlinks.
a44610b to
de40dfd
Compare
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
Adds tests that verify preserve-local mode handles the WP Cloud Atomic theme layout correctly.
On Atomic, per-site themes are symlinks at
wp-content/themes/<theme>pointing to../../wordpress/themes/pub/<theme>(shared infrastructure reached through the/wordpress/symlink). The per-site symlink's parent directory (wp-content/themes/) is site-owned — no symlinks in the path — so preserve-local allows creating it. The target passes validation becauseassert_symlink_target_within_rootusesnormalize_path(string-only, no symlink resolution).The tests confirm both sides of the rule:
No production code changes — this is a test-only PR. The existing preserve-local logic already handles this case correctly. The missing-theme bug from the Atomic-to-Atomic migration needs further investigation with the audit log.
Test plan
testPreserveLocalAllowsSymlinkPointingThroughSharedDir— symlink at site-owned path, target through shared dirtestPreserveLocalBlocksSymlinkInsideSharedDir— symlink inside shared dir blockedtestDeltaDiffIncludesSymlinkInSiteOwnedDir— diff phase includes symlink at site-owned pathtestDeltaDiffSkipsEntriesInsideSharedDir— diff phase blocks both files and symlinks in shared dirs