-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: update security warnings around server.cors
and server.allowedHosts
#19378
docs: update security warnings around server.cors
and server.allowedHosts
#19378
Conversation
Co-authored-by: "Dominik G." <dominik.goepel@gmx.de>
docs/config/server-options.md
Outdated
::: danger | ||
|
||
We recommend setting a specific value rather than `true` to avoid exposing the source code to untrusted origins. | ||
Setting this to `true` grants any websites to send requests to your dev server, allowing them to download your source code and content. We recommend always using an explicit list of allowed origins. | ||
|
||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dominikg I updated the warning here based on your suggestion 👍
docs/config/server-options.md
Outdated
::: danger | ||
|
||
Setting this to `true` virtually grants any websites to send requests to your dev server by DNS rebinding attacks, allowing them to download your source code and content. We recommend always using an explicit list of allowed hosts. See [GHSA-vg6x-rcgg-rjx6](https://github.com/vitejs/vite/security/advisories/GHSA-vg6x-rcgg-rjx6) for more details. | ||
|
||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a similar warning to server.cors
for server.allowedHosts
as well. Technically, it is safe to set server.allowedHosts: true
if the dev server runs behind a reverse proxy (the reverse proxy needs to check the host in that case though). But I didn't mention it here as I guess that usage isn't common and setting allowedHosts
doesn't hurt.
::: details What hosts are safe to be added? | ||
|
||
Hosts that you have control over which IP addresses they resolve to are safe to add to the list of allowed hosts. | ||
|
||
For example, if you own a domain `vite.dev`, you can add `vite.dev` and `.vite.dev` to the list. If you don't own that domain and you cannot trust the owner of that domain, you should not add it. | ||
|
||
Especially, you should never add Top-Level Domains like `.com` to the list. This is because anyone can purchase a domain like `example.com` and control the IP address it resolves to. | ||
|
||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While CORS is a general thing, this allowedHosts is not that general and the users weren't sure what value are safe to be set. I added a explanation here.
Co-authored-by: patak <583075+patak-dev@users.noreply.github.com>
Description
refs #19345
refs ddev/ddev.com#313 (review)
refs #19287
refs storybookjs/storybook#30432