php-tuf / composer-stager

Stages Composer commands so they can be safely run on a codebase in production.
MIT License
16 stars 8 forks source link

Make "directory is writable" preconditions recursive #67

Open TravisCarden opened 1 year ago

TravisCarden commented 1 year ago

@tedbow our ActiveDirIsWritable and StagingDirIsWritable preconditions currently only test that the top level directories themselves are writable. Non-writable children and descendants therefore would not be caught until they actually cause failures during file syncing, potentially corrupting the codebase. I think we should make the checks recursive, even though that will make them slower. What do you think?

cc @phenaproxima @wimleers

phenaproxima commented 1 year ago

Personally, I'm +1 for this.

I think that, from a usefulness standpoint, performance is less important than correctness. Being able to detect problems before they happen is more valuable.

The one caveat I can think of here is that, in some cases, there are some directories that won't be writable, and shouldn't be writable, and will also be ignored by the staging operations. It would be good to be able to specify which paths should simply be ignored during permission checks.