Fix redundant resolved-env injection on Cloudflare, warn on unencrypted Vercel deploys#881
Open
theoephraim wants to merge 3 commits into
Open
Fix redundant resolved-env injection on Cloudflare, warn on unencrypted Vercel deploys#881theoephraim wants to merge 3 commits into
theoephraim wants to merge 3 commits into
Conversation
…ed Vercel deploys Astro's @astrojs/cloudflare adapter defaulted ssrInjectMode to 'resolved-env', baking the fully resolved (potentially sensitive) env into the worker bundle even though the Cloudflare runtime loader immediately overwrites it from bindings at boot. Now defaults to init-only like Vite/SvelteKit already did. Also add a build-time throw if a user explicitly sets ssrInjectMode: 'resolved-env' while a Cloudflare target is detected, and a one-time warning (Vite, Next.js webpack/turbopack) when deploying to Vercel with resolved-env injection and no @encryptInjectedEnv enabled, since that ships secrets as plaintext JSON in the build artifact.
Contributor
|
The changes in this PR will be included in the next version bump.
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
varlock-website | 14ab468 | Commit Preview URL Branch Preview URL |
Jul 12 2026, 06:45 AM |
varlock
@varlock/astro-integration
@varlock/cloudflare-integration
@varlock/nextjs-integration
@varlock/vite-integration
commit: |
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
@astrojs/cloudflareadapter defaultedssrInjectModetoresolved-env, baking the fully resolved (potentially sensitive) env into the worker bundle even though the Cloudflare runtime loader already overwrites it from bindings at boot. Now defaults toinit-only, matching Vite/SvelteKit's existing behavior.varlockVitePlugin()now throws at build time ifssrInjectMode: 'resolved-env'is explicitly set while a Cloudflare target is detected (SvelteKit +adapter-cloudflare,@varlock/cloudflare-integration, or the Astro Cloudflare branch), pointing users at the nativevarlock-wranglerinjection path instead.@encryptInjectedEnvnot enabled, since that ships secrets as plaintext JSON in the build artifact.vite.mdxandencrypted-deployments.mdx.Test plan
@varlock/vite-integration,@varlock/astro-integration,@varlock/cloudflare-integration,@varlock/nextjs-integrationall build cleanlyisCloudflareTargetis set, and doesn't fire otherwiseVERCEL=1+ no encryptionastro build) builds cleanly