android-password-store / Android-Password-Store

Android application compatible with ZX2C4's Pass command line application
https://passwordstore.app
GNU General Public License v3.0
2.56k stars 254 forks source link

[BUG] symlinks are clobbered by the app #636

Closed msfjarvis closed 2 years ago

msfjarvis commented 4 years ago

Describe the bug A password will fail to decrypt if it is a soft link as opposed to a normal file.

To Reproduce Steps to reproduce the behavior:

  1. Create a password that's a soft link to an existing password using ln -s <passwd>.gpg softlink.gpg
  2. Pull the repository on device
  3. Try to decrypt the password
  4. See error

Expected behavior Password is decrypted and shown in the UI

Device information (please complete the following information):

Additional context

Relevant log snippet

E  onError getErrorId: 0
E  onError getMessage: No valid OpenPGP encrypted or signed data found!
msfjarvis commented 3 years ago

Not at the moment and it doesn't seem like we can do a lot about this either. We've already applied the official recommendations on symbolic link support.

timvisee commented 3 years ago

Could an option to prevent pushing to the remote be added? That would prevent pushing the broken state to the git remote, and to the rest of my machines, at the cost of not adding passwords modified on my phone. I understand that this isn't a solution, but that would at least allow me to sync my passwords to my phone. I hope I'm not going too off-topic with this question.

msfjarvis commented 3 years ago

Could an option to prevent pushing to the remote be added? That would prevent pushing the broken state to the git remote, and to the rest of my machines, at the cost of not adding passwords modified on my phone. I understand that this isn't a solution, but that would at least allow me to sync my passwords to my phone. I hope I'm not going too off-topic with this question.

You can simply use the pull option rather than synchronize, unless I'm not understanding the request?

timvisee commented 3 years ago

@msfjarvis Awesome, just noticed the option now. I've always dragged down which apparently synchronizes. This is perfect, thanks for the quick response.

equaeghe commented 3 years ago

[…] I've always dragged down which apparently synchronizes. […]

This is the problem for me. I have symlinks in my store and apparently cannot avoid to mistakenly drag down when in passwordstore. This then requires a forced push from another clone to undo the desymlinking. Having an option to assign drag-down to pull instead of push+pull(?) or marking the upstream as read-only would really be useful, given the symlink issue.

msfjarvis commented 3 years ago

[…] I've always dragged down which apparently synchronizes. […]

This is the problem for me. I have symlinks in my store and apparently cannot avoid to mistakenly drag down when in passwordstore. This then requires a forced push from another clone to undo the desymlinking. Having an option to assign drag-down to pull instead of push+pull(?) or marking the upstream as read-only would really be useful, given the symlink issue.

I think a read-only option would be a good idea, I'll see what I can do about it.

pmartycz commented 3 years ago

Here's a little script I run to unfuck the symlinks (remove echo before command after you verify it does what you want)

for f in ~/.password-store/**; do if [ 'text/plain' = "$(file -b --mime-type "$f")" ]; then echo ln -sf -- "$(cat "$f")" "$f"; fi; done
msfjarvis commented 2 years ago

It might be worth a shot to expand the FS.Factory we added to use AndroidRetroFile for implementing support on lower Android versions. The library does not provide default implementations of FileSystemProvider and FileTypeDetector but it should be possible to copy that over from MaterialFiles since the license is compatible. I started work on it in this branch, feel free to take a stab at getting the providers implemented.

msfjarvis commented 2 years ago

I believe at this point we've exhausted all avenues and there is no progress to be made, so I'm closing this as part of issue tracker cleanup.

msfjarvis commented 10 months ago

Symlinks work properly in the latest snapshot build, make sure to delete and re-clone your existing repo for JGit's auto-detection of symlink support to kick in.