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
Helping prevention of accidental directory exclusion when using the --export-on-exit option #4127
Helping prevention of accidental directory exclusion when using the --export-on-exit option #4127
Conversation
…der to the CWD, inflicting in directory exclusion after stopping the emulators
…citly via the set of --import
Thanks for the PR! Getting someone to take a look |
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.
Overall I think is a good stop-gap solution and I'm happy to merge this once the comments are addressed. (It would be even better though if we can find a way to export without nuking the target directory, but that is a longer term solution.)
Fixed a cenario where the user could ingress a pattern of cwd and it would fail incorrectly
Yup, I just built this PR in like 1 hour to reduce the chances for people to accidentally exclude their projects by runnning the command without prior understanding. I almost lost 2 weeks of work because of this. If someone would try with their root user folder the destruction would be massive. If I get the time, I will try to dive into the core of firebase persistency to fix this in a definitive manner and possibly rollback this PR. Thanks for pointing out which PR (supposedly) introduced the issue, that will save up some time :) |
Thanks again for your contribution! This PR is now merged and will be included in the next release. |
Description
Adding condition to prevent the user from setting the --export-on-exit option to the CWD, inflicting in directory exclusion after stopping the emulators
Scenarios Tested
The firebase emulators:start command should fail now if the --export-on-exit is set to the CWD or parent directories
Commands tested:
Current dir (SHOULD FAIL):
firebase emulators:start --export-on-exit ./
Current dir parent (SHOULD FAIL):
firebase emulators:start --export-on-exit ../
Implicit --export-on-exit via setting the --import flag (SHOULD FAIL):
firebase emulators:start --import ./ --export-on-exit
A sub directory (SHOULD PASS):
firebase emulators:start --export-on-exit ./dump-db
Implicit --export-on-exit sub directory (SHOULD PASS):
firebase emulators:start --import ./dump-db --export-on-exit
Sample Commands
Should not allow:
One that should allow: