fix(blob): switch to private access with auth-gated delivery route#1483
Draft
fix(blob): switch to private access with auth-gated delivery route#1483
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
4b7dd89 to
a0df8cc
Compare
User-uploaded images should not be publicly accessible. This switches from public to private blob storage and adds a delivery route that proxies files through the server. Changes: - Upload route: access 'public' -> 'private', addRandomSuffix, returns delivery route URL instead of raw blob URL - New /api/files/serve route: proxies private blobs with ETag caching, Content-Disposition: inline for browser display - next.config.ts: localPatterns for next/image, removed public blob domain - proxy.ts: skip middleware auth for serve route (image optimizer can't forward cookies, pathname unguessability provides security) - vercel-template.json: force private access in 1-click deploy - Upgraded @vercel/blob to 2.3.3 for get() support
a0df8cc to
4e99a4e
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
User-uploaded images are auth-gated content that should not be publicly accessible. This switches from public to private blob storage and adds a delivery route that checks the user's session before serving files.
Changes:
access: "public"->access: "private", returns/api/files/serve?pathname=...instead of raw blob URL/api/files/serveroute: checks auth, streams private blob with ETag caching support*.public.blob.vercel-storage.comfromnext.config.tsimage patternsvercel-template.json: forces private access in 1-click deploy flowNo client changes needed — the upload response interface (
{ url, pathname, contentType }) is preserved, andnext/imageworks with same-origin URLs withoutremotePatterns.Test deploy: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fchatbot%2Ftree%2Fblob-private-access
Context
Aligns with the private-by-default direction for Vercel Blob (see vercel/front#65379, vercel/vercel#15375). The CLI now defaults to private-first prompts and requires explicit
--accessflags.🤖 Generated with Claude Code