Skip to content
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

feat: add .git to deny list by default #18382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

patak-dev
Copy link
Member

Description

Even if credentials shouldn't be committed to git, we discussed with others in the team that it makes sense to add .git to the default server deny list.

@patak-dev patak-dev added p2-nice-to-have Not breaking anything but nice to have (priority) feat: dev dev server labels Oct 17, 2024
Copy link

stackblitz bot commented Oct 17, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@patak-dev patak-dev added this to the 6.0 milestone Oct 17, 2024
@@ -1035,7 +1035,12 @@ export function resolveServerOptions(
middlewareMode: raw?.middlewareMode || false,
}
let allowDirs = server.fs?.allow
const deny = server.fs?.deny || ['.env', '.env.*', '*.{crt,pem}']
const deny = server.fs?.deny || [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to push the .git in any case even with user provided list, and do we need the glob at start and end or is .git by itself enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to have the glob at the start, it doesn't hurt and it could cover some edge cases (the repo being nested in the root).

About adding it always, I thought about that, but I think it is better to keep the current way. If deny: [], it should mean that the user wants to expose everything.

Copy link
Contributor

@dominikg dominikg Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to export our default deny list so that the user can do [...viteDeny, 'my','own','stuff'] without resorting to a config plugin

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is a good idea 👍🏼
Let's do it in a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: dev dev server p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants