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
Close tmpfile after writing #685
Conversation
Windows will not allow for deletion of a file with an open handle, close tmpfile after writing to prevent unencrypted tmpfiles out-living the execution
Codecov Report
@@ Coverage Diff @@
## develop #685 +/- ##
========================================
Coverage 38.23% 38.23%
========================================
Files 23 23
Lines 3329 3329
========================================
Hits 1273 1273
Misses 1927 1927
Partials 129 129 Continue to review full report at Codecov.
|
Does it actually fix the issue completely? We should probably delete the temp file entirely. |
I think so, but I didn't find the original problem and would like to get a confirmation from yourself (as a maintainer) and @xtrasolver (who opened the issue) before I say "done" with certainty.
Yes indeed! Here's my 3-cent analysis: Linux lets you delete a file from disk while its open in an editor but Windows protects a file while it is open in an editor. Adding a close statement lets the downstream |
Thanks for your explanation, I missed that we were actually deleting the entire directory. However, you're currently closing the file before we're done using it. I'd add a |
Co-authored-by: Adrian Utrilla <adrianutrilla@gmail.com>
Per your instruction I added a |
Thanks! |
* Close tmpfile after writing Windows will not allow for deletion of a file with an open handle, close tmpfile after writing to prevent unencrypted tmpfiles out-living the execution * Update cmd/sops/edit.go Co-authored-by: Adrian Utrilla <adrianutrilla@gmail.com> * defer edited file close Co-authored-by: Adrian Utrilla <adrianutrilla@gmail.com>
This PR closes #624
Windows will not allow for deletion of a file that has an open handle.
Close tmpfile after writing to prevent unencrypted tmpfiles out-living
the execution of sops.