Repository navigation
fix(cloudflare): fix baseURL traversal for wrangler assets dir - #4257
Conversation
|
@jel-massih is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Cloudflare preset now generates the module target's assets directory path with repeated ChangesWrangler Module Target Path Formatting
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thnx. Can you please provide reproductin steps? |
Sure! Updated PR with hopefully useful repro steps. Validated issue with basically these commands with grep output: |
…e-baseurl-traversal # Conflicts: # src/presets/cloudflare/utils.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
"..".repeat(N)concatenates without a separator, so forN >= 2it produces"...."/"......"instead of"../.."/"../../..". With a 2+ segmentbaseURL(e.g./foo/bar),cloudflare-modulebuilds generate awrangler.jsonwhoseassets.directoryresolves to a non-existent....subdirectory, breakingwrangler deployand static asset serving.Fix:
"..".repeat(N)→"../".repeat(N)so the traversal works as expectedReproduction Steps:
Build any cloudflare-module (or cloudflare-durable) project with a baseURL of 2+ segments, e.g.:
Then check the generated .output/server/wrangler.json: assets.directory value
Before fix:
After fix: