Skip to content

The build manifest .vite/manifest.json is publicly downloadable / 构建清单 .vite/manifest.json 可被公开下载 #774

Open

Description

@wintercn

Problem

The client build manifest .vite/manifest.json is deployed as a public static asset. Anyone can download it.

Versions: void@1.7.0, @void/vue@1.7.0.

Reproduction

https://gist.github.com/wintercn/e0699d0ae6d343f198df8feaab5d6369

After npm run build, the asset output contains .cloudflare/output/v0/workers/default/assets/.vite/manifest.json.

With npm run preview, the app has no route for this path:

/.vite/manifest.json   200 application/json  the client build manifest

Expected

The build manifest is not served to clients.

Analysis

createManifestLoader (void/dist/routing-assets-DJIVOrCh.mjs:36) reads globalThis.__VITE_MANIFEST__ first and falls back to ASSETS.fetch("/.vite/manifest.json"). The build never sets __VITE_MANIFEST__, so the runtime depends on the manifest being a public asset.

A possible fix: inject the client manifest into the server bundle as __VITE_MANIFEST__ at build time, and stop deploying .vite/ as static assets.


问题

客户端构建清单 .vite/manifest.json 被部署为公开静态资源,任何人都能下载。

版本:void@1.7.0、@void/vue@1.7.0。

复现

https://gist.github.com/wintercn/e0699d0ae6d343f198df8feaab5d6369

执行 npm run build 后,静态资源输出中包含 .cloudflare/output/v0/workers/default/assets/.vite/manifest.json。

执行 npm run preview,应用中没有匹配这个路径的路由:

/.vite/manifest.json   200 application/json  客户端构建清单

预期

构建清单不向客户端提供。

分析

createManifestLoader(void/dist/routing-assets-DJIVOrCh.mjs:36)先读 globalThis.__VITE_MANIFEST__,没有时用 ASSETS.fetch("/.vite/manifest.json") 读取。构建流程从不设置 __VITE_MANIFEST__,所以运行时依赖清单作为公开静态资源存在。

可行的修法:构建时把客户端清单注入服务端包作为 __VITE_MANIFEST__,不再把 .vite/ 部署为静态资源。

Activity

  1. TheAlexLichter commented on Nov 16, 2026

    @TheAlexLichter
    Member

    Thanks for the issue. This is Vite’s documented behavior behavior though : enabling build.manifest writes .vite/manifest.json into the client build output.

    There’s an existing upstream request to allow generating it outside that directory: vitejs/vite#19279

    Note: Th manifest doesn’t contain secrets. The referenced client bundles are already publicly downloadable.
    It is not a demonstrate a security vulnerability (although it makes the frontend structure a bit easier to inspect)

    Is there a specific sensitivity issue in your case? More info would be helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions