-
Notifications
You must be signed in to change notification settings - Fork 919
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
sops edits a readonly temp file on Windows #1044
Comments
So, I believe this bug will happen with any editor that attempts to call On Windows, the Go standard library opens files with only There are a couple of solutions here:
I feel the first option is most appropriate, inelegant as it may be. |
Immediately close the temporary file created by `sops` before invoking the user's editor. On Windows the standard library opens file handles with only shared read and write access, which can prevent other processes (like editors) that require opening handles with delete access to those same files.
When will this fix get merged/released? EDIT: I see the PR was closed almost immediately - is there another work around/fix? |
This has been released in https://github.com/getsops/sops/releases/tag/v3.8.0-rc.1 via #1265. Official |
So even with the new version of sops it still tries to create the file in my temp folder - I can't move it /re-save it without it breaking the actual encryption action - its not really usable on Windows as far as I can tell |
The file getting created in a temporary folder is by design, the idea is that SOPS will open an editor to modify the file and wait until you have stored your change. I do not see why you would want to move and/or re-save it. Also see #127. |
okay - so earlier when I saved (my editor is vscode with wait) it would tell me file not changed and nothing would happen. I must have fixed something (not sure what) but now when I save the temp file it puts the encrypted counterpart in my working directory which is what I was expecting based on the documents. Thanks! |
I have a sops encrypted file
foo.enc.json
and when I runsops foo.enc.json
, vim tells me:This happens both on Windows and Cygwin, so I guess it's an issue with the Windows binary. This issue doesn't appear on the Linux binary. Tested on Sops v3.7.2.
I think the function in
editTree
inedit.go
is where it's at, but my Go's real rusty. Please tell me if I can assist in some way.https://github.com/mozilla/sops/blob/v3.7.2/cmd/sops/edit.go#L110
The text was updated successfully, but these errors were encountered: