Skip to content

Allow symlink creation through symlinked dirs in preserve-local#134

Open
adamziel wants to merge 1 commit into
trunkfrom
adamziel/missing-theme-import
Open

Allow symlink creation through symlinked dirs in preserve-local#134
adamziel wants to merge 1 commit into
trunkfrom
adamziel/missing-theme-import

Conversation

@adamziel

@adamziel adamziel commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

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 because assert_symlink_target_within_root uses normalize_path (string-only, no symlink resolution).

The tests confirm both sides of the rule:

  • Symlinks at site-owned paths are allowed, even when they point through shared dirs
  • Entries inside shared directories (parent path traverses a symlink) are blocked for both files and symlinks equally

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 dir
  • testPreserveLocalBlocksSymlinkInsideSharedDir — symlink inside shared dir blocked
  • testDeltaDiffIncludesSymlinkInSiteOwnedDir — diff phase includes symlink at site-owned path
  • testDeltaDiffSkipsEntriesInsideSharedDir — diff phase blocks both files and symlinks in shared dirs
  • All 18 ImportSymlink + FilesSyncState tests pass

@adamziel adamziel force-pushed the adamziel/missing-theme-import branch 2 times, most recently from bbc4546 to a44610b Compare April 15, 2026 18:32
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.
@adamziel adamziel force-pushed the adamziel/missing-theme-import branch from a44610b to de40dfd Compare April 15, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant