Skip to content
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

Strip .gpg from password keys #56

Closed
tophattom opened this issue Feb 26, 2015 · 13 comments
Closed

Strip .gpg from password keys #56

tophattom opened this issue Feb 26, 2015 · 13 comments

Comments

@tophattom
Copy link
Contributor

When creating a new password in the store, www/facebook.com for example, pass automatically adds .gpgextension resulting in a file named www/facebook.com.gpg. passff tries to get password with a key including the .gpg extension which results in an error: Error: www/facebook.com.gpg is not in the password store.

@phryneas
Copy link
Contributor

Wow, you really get every error you can possibly get ;)

But this time, I think it really is a pass error.

passff just uses the output of pass to get all the key names. (it parses that tree-like output)

In your example from #55 that was

Password Store
└── www
    └── facebook.com.gpg

If pass were working correctly, you would have

Password Store
└── www
    └── facebook.com

instead.

Now, pass has had its problems with different implementations of tree, for example I have encountered that it failed stripping the .gpg extension when output was colorized.

Actually, I submitted this patch
http://git.zx2c4.com/password-store/commit/?id=c34d172ec14b06de82c04eecf86af66cd26379d6
which I thought should have taken care of that problem - but maybe I missed something.

While this would belong on the password-store mailing list, lets try it here quick, maybe I can help you.

Is the output from pass colorized in any way or some other way suspicious?

@tophattom
Copy link
Contributor Author

Well, how are we going to squash bugs if nobody finds them? ;)

Anyways, the output of pass looks like:
nayttokuva 2015-2-26 kello 14 46 35
This in zsh (my default shell) with zprezto and some theme. In bash it's the same except for the fancy ~ >>>

@phryneas
Copy link
Contributor

Hrm. That does not look suspicious to me in any way :|

Lets see if there are any hidden characters.

What is the output of pass | cat -v ? (Yes, that will look weird, don't worry)

On a sidenote: how happy are you with zprezto? I'm currently using oh-my-zsh, but I'm open for alternatives ;)

@tophattom
Copy link
Contributor Author

Password Store
?M-^TM-^T?M-^TM-^@?M-^TM-^@ ^[[34mwww^[[00m
    ?M-^TM-^T?M-^TM-^@?M-^TM-^@ facebook.com.gpg

Offtopic:
I'm totally happy with prezto. Though I haven't used oh-my-zsh or anything else for that matter so I don't have much to compare with.

@phryneas
Copy link
Contributor

Hmm, that looks completely fine for me, I could not imagine that there would be any problem for pass parsing that.

If you are not on pass 1.6.5 you could try updating it - other that that, I'm sorry, but I can't help you.

You'll likely have to go to the password-store mailing list.

Oh, maybe one more thing to try: does this differ from the output of tree -C -l --noreport ~/.password-store | cat -v?

Offtopic: ohmy is great, but takes a second to start. I might give prezto a go ;)

@tophattom
Copy link
Contributor Author

Hmm. pass is version 1.6.5. I tried using the line from your patch:

tree -C -l --noreport ~/.password-store | tail -n +2 | sed 's/\.gpg\(\x1B\[[0-9]\+m\)\{0,1\}$/\1/'
└── www
    └── facebook.com

Witchcraft.

EDIT:
Looks like the current pass ships with different parsing for the tree command and it seems to work incorrectly. pass line 325:

tree -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed 's/\.gpg\(\x1B\[[0-9]\+m\)\{0,1\}\( ->\|$\)/\1\2/g'

@phryneas
Copy link
Contributor

Voodoo. At least.

It looks that they modified it since ( http://git.zx2c4.com/password-store/commit/src/password-store.sh?id=5f3e0b36af40c1fc5991fce76e9998313d36c6ee ) - now it is

tree -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed 's/\.gpg\(\x1B\[[0-9]\+m\)\{0,1\}\( ->\|$\)/\1\2/g'

which does work on my system well enough.

What does it do on your system if you call it from the cli?

@tophattom
Copy link
Contributor Author

tree -C -l --noreport .password-store | tail -n +2 | sed 's/\.gpg\(\x1B\[[0-9]\+m\)\{0,1\}\( ->\|$\)/\1\2/g'
└── www
    └── facebook.com.gpg

@phryneas
Copy link
Contributor

Phew. Seriously, I don't see why. Maybe something strange with OSX sed or something.

Try the mailing list, there's a couple of users using every strange distribution, including some BSD/OSX users on there, maybe someone knows something.

Until you resolve it, for day-to-day work, you can always just revert to that old version of that line that seems to be working.

PS: with the line patched, is passff finally working for you? :)

@tophattom
Copy link
Contributor Author

It seems to be working after I patched lines 325 and 337 (where the same regex was used again).

Thanks for your help @phryneas! I'll close this since the problem is not really passff related.

@phryneas
Copy link
Contributor

You're welcome. I'm glad it's working now :)

@phryneas
Copy link
Contributor

phryneas commented Mar 8, 2015

For anyone experiencing the same problem: I have submitted a patch to the mailing list, but Jason seems to be inactive at the moment, so I don't know when it will be merged.
Until then just get the patch from here: phryneas/password-store@2fbafeb

@faern faern mentioned this issue Jun 17, 2015
@phryneas
Copy link
Contributor

For future reference: this is in the passwordstore git repo by now, but not yet included in a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants