Closed
Description
Describe the bug
In a ssr build, ssr-manifest.json and ssrContext (in the dist/server/entry-server.js
file), will contain the complete filenames (including the folder structure) present in the source code. This causes two problems:
- It may "leak" personal or confidential information about the source code being built
- It could be the internal and private structure of the source code
- it could be the name of the developers building their applications (if it is present, for instance, in the home folder where the application source code resides)
- More importantly, it makes a build "non deterministic"
- Two programmers in the same organization, using the exact same codebase, will generate distinct builds differing only on these specific files, based on the layout of their file systems and where they stored the source code
Submitted #3315 as a comprehensive fix
Reproduction
git clone https://github.com/vitejs/vite.git vite
cd vite
yarn
yarn build
cd packages/playground/ssr-vue
yarn build
Two files will contain complete paths from the source code:
- packages/playground/ssr-vue/dist/client/ssr-manifest.json
- packages/playground/ssr-vue/dist/server/entry-server.js
System Info
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:
System:
OS: Windows 10 10.0.19041
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Memory: 3.22 GB / 7.91 GB
Binaries:
Node: 15.11.0
Yarn: 1.22.10
npm: 7.6.0
Browsers:
Chrome: 90.0.4430.93
Edge: Spartan (44.19041.906.0), Chromium (90.0.818.51)
Internet Explorer: 11.0.19041.1
Used package manager:
yarn
Logs
N/A
Other comments
Here is a "naive" solution for the root cause
EDIT: Sent a #3315 as a more robust implementation that solves both the "leak" and the determinism issues.
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.