Bisa / factorio-init

Factorio init script
MIT License
415 stars 82 forks source link

Ensure update tmpdir is created securely and cleaned up automatically #133

Closed jadoc closed 5 years ago

jadoc commented 6 years ago

Current temporary directory creation is predictable and non-atomic. Therefore, it's not secure. It is possible for another user to pre-create the directory and poison it's contents. Using mktemp avoids this vulnerability.

Also, the conditional logic requires a copy of the cleanup command at the end of every place where installation may abort after temporary directory creation. It is better to set up a trap on EXIT in one place immediately after directory creation. Thus, additional changes to conditional logic can't accidentally omit correct cleanup logic.