Skip to content

fix(wrangler): use lstat so the asset walker skips symlinks as intended#14643

Open
evilgensec wants to merge 8 commits into
cloudflare:mainfrom
evilgensec:fix-asset-walker-lstat
Open

fix(wrangler): use lstat so the asset walker skips symlinks as intended#14643
evilgensec wants to merge 8 commits into
cloudflare:mainfrom
evilgensec:fix-asset-walker-lstat

Conversation

@evilgensec

@evilgensec evilgensec commented Jul 10, 2026

Copy link
Copy Markdown

What this changes

The Workers and Pages asset walkers intend to skip symbolic links:

if (filestat.isSymbolicLink()) {
  return;
}

but they call stat() first, which dereferences the symlink, so isSymbolicLink() always returns false. As a result, symlinked entries inside an assets directory are followed and their targets are collected/uploaded as assets instead of being skipped. Per the Node docs, Stats.isSymbolicLink() is only meaningful after lstat() (after stat() the link has already been resolved).

The fix

Switch both walkers to lstat() so the existing isSymbolicLink() skip logic works as intended. No behavior change for regular files or directories.

  • packages/deploy-helpers/src/deploy/helpers/assets.ts
  • packages/wrangler/src/pages/validate.ts

A changeset is included (patch for wrangler and @cloudflare/deploy-helpers).


Open in Devin Review

Copilot AI review requested due to automatic review settings July 10, 2026 08:53
@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9126a1f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
wrangler Patch
@cloudflare/deploy-helpers Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workers-devprod workers-devprod requested review from a team and james-elicx and removed request for a team July 10, 2026 08:53
@workers-devprod

workers-devprod commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/asset-walker-lstat-symlink.md: [@cloudflare/wrangler]
  • packages/deploy-helpers/src/deploy/helpers/assets.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/tests/pages/project-validate.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/pages/validate.ts: [@cloudflare/wrangler]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

evilgensec and others added 2 commits July 10, 2026 14:48
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

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.

3 participants