Potential source leakage risk: server.publicDir.copyOnBuild = "auto" #7185
quanquan2100
started this conversation in
General
Replies: 1 comment 1 reply
-
|
Thanks for the suggestion. I think we can add a note in the documentation to clarify this behavior, but it’s not worth changing the default for this edge case since it would be a breaking change and introduce unnecessary complexity. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Docs: https://rsbuild.rs/config/server/public-dir#options
Problem
server.publicDir.copyOnBuild defaults to auto, which means a dev-server config can implicitly affect production build output (copy files into dist). This can cause accidental source/code leakage if publicDir points to a sensitive folder.
Example scenario
In some legacy projects, images are referenced by fixed paths (e.g. /images/foo.png). To make it work in dev, people may set publicDir to a directory that contains those images—sometimes even src/. If they forget to set copyOnBuild: false, build output may copy that directory into dist.
Suggestions
Curious what the current intended behavior of "auto" is and whether a warning/safer default would be acceptable.
Beta Was this translation helpful? Give feedback.
All reactions