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

Cache can delete a lot if improperly set #1658

Open
hunse opened this issue Dec 7, 2020 · 0 comments
Open

Cache can delete a lot if improperly set #1658

hunse opened this issue Dec 7, 2020 · 0 comments

Comments

@hunse
Copy link
Collaborator

hunse commented Dec 7, 2020

Describe the bug

I haven't experienced this thankfully, but when working on our cache code I noticed that there are a couple of places where we remove all files in a directory, and all files in all subdirectories. This could be really dangerous if somebody incorrectly sets their cache dir (e.g. in nengorc) and then has all the files in that directory deleted.

Expected behavior

One solution would be to have some sort of naming convention and/or extension, and only remove files that match that. That could extend to directories, too (i.e. we'd only recurse into/delete directories matching the naming convention).

Another solution (that could be instead of or in addition to the first) would be to have the decoder_cache.path in nengorc just specify the base of the path (e.g. ~/.cache/nengo) and then within that we make a decoders folder (or something like that), and we only touch files in that subfolder. That way, even if somebody set their path to ~, we'd still make a decoders folder and add/delete things there, rather than potentially deleting all files in their home directory.

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

No branches or pull requests

1 participant