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

Add .storybook to server.fs.allow #427

Merged
merged 4 commits into from Jul 7, 2022
Merged

Conversation

benmccann
Copy link
Contributor

Closes #426

@IanVS
Copy link
Member

IanVS commented Jul 6, 2022

Thanks for the PR. Do you know why this might be necessary? With my understanding of the fs.strict config option (https://vitejs.dev/config/#server-fs-strict), files and folders inside the root should be allowed by default. Is this maybe a bug in vite?

@benmccann
Copy link
Contributor Author

benmccann commented Jul 6, 2022

I think the docs are wrong. As soon as you specify one directory in the allow list it no longer allows the workspace root:

https://github.com/vitejs/vite/blob/f280dd99856af68a47635dda609c402333805209/packages/vite/src/node/server/index.ts#L683

SvelteKit adds directories to the allow list by default, so I think the workspace root would not get added:

https://github.com/sveltejs/kit/blob/0915cb5c1a6edb07ac915c24c69cb47d1d15e3de/packages/kit/src/vite/index.js#L169

@IanVS
Copy link
Member

IanVS commented Jul 6, 2022

Oh I see, thanks. In that case, I'm reluctant to merge this change, as it would have the same impact for everyone else not using sveltekit who might need files in other directories within the workspace root. I don't suppose the sveltekit vite plugin could re-add the workspace root, so as to restore the default behavior?

@benmccann
Copy link
Contributor Author

Good point. I've updated this with a new solution that will still work if the user hasn't defined server.fs.allow. We don't want to add the workspace root in SvelteKit as we consider that behavior to be insecure.

@IanVS IanVS merged commit c455b7e into storybookjs:main Jul 7, 2022
@IanVS
Copy link
Member

IanVS commented Jul 7, 2022

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] missing server.fs.allow for .storybook
2 participants