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
antsibull-docs expects dest-dir to exist #140
Comments
So this (and a few other strict permission checks in antsibull) are because there's various insecurities in creating directories. The easiest thing to do is to punt that to the user; forcing them to create the directory. (although that's far from perfect... just because they create the directory doesn't mean that they have made sure that it is all secure). I don't think I'm going to put effort into changing this for quite a while but there are certain things that could be done if someone else wants to look into it before me. We probably need to walk backwards up the directory tree, looking at the ownership and permissions of all the directories to make sure they're only writable by the user. We can stop when we hit either the root directory or the user's home directory. It might be okay to special case the user's home directory and flat out say that any subdirectory of that is okay. Symlinks probably need to be handled differently than real subdirectories in that case, though. I can't think of any other specialcases that could be more permissive but there could be others. |
I am not sure which insecurities you're mentioning, after all we're just dumping a ton of RST files in a folder. But nevertheless, I think at least the traceback shouldn't happen and the user should get a nice one-line message "please create the destination"? Maybe with an explanation what they should take care of to be secure? |
That traceback is definitely a bug, a few lines below it would have reported the non-existing directory - if it wouldn't have crashed before. The security problems are the following: if you have a malicious user in your system, and that user owns the directory, or a more top-level directory (that's not checked yet), they could rename something in the path and create a symlink instead to point somewhere where the user running antsibull can write (but the malicious user cannot), resulting in the user running antsibull accidentally writing files to a location where it does not want to write them to. This probably isn't a problem in many contexts (like on single-user systems, or when running this in your home directory, which should be sufficiently protected), but appears to be a potential problem in the way it is used internally by the ansible team. |
#144 should fix the crash and improve the error messages. |
evgeni commentedJul 21, 2020
This is unexpected (for me), as I'd think it would create the directory when it does not exist yet.
The text was updated successfully, but these errors were encountered: