abcxyz / abc

Apache License 2.0
12 stars 3 forks source link

Making of copy of the input template may be unnecessary when it's a local directory #458

Open drevell opened 8 months ago

drevell commented 8 months ago

Currently, we always create a temporary directory called the "template directory," and copy the template contents into that directory. This makes sense when the template is a remote (e.g. a github repo), but is perhaps unnecessary when the template is just stored in a local directory.

The LocalDownloader could perhaps be replaced by a no-op that just points to the existing template files that are already on the filesystem. Currently the LocalDownloader copies the files into the template directory (a temp dir) for no great reason.

Before we do this, we'll want to be sure that we never modify the template directory. Because it's OK to modify our private temp dir copy of the template, but it's not OK to modify any files outside of temp dirs that are owned by the user.

drevell commented 7 months ago

I remembered why we don't do this: when abc create the template directory itself, it can guarantee that there are no symlinks. If there were symlinks, things could get complex. We could scan the template directory for symlinks and reject any that refer to a location that's outside the template directory.