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

Runtime error on bitw dump #28

Closed
xPMo opened this issue Jul 24, 2021 · 2 comments
Closed

Runtime error on bitw dump #28

xPMo opened this issue Jul 24, 2021 · 2 comments

Comments

@xPMo
Copy link

xPMo commented Jul 24, 2021

Let me know if there's any way I could provide more info.

❯ ./bitw dump
Password:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x71707b]

goroutine 1 [running]:
main.run(0xc00012e010, 0x1, 0x1, 0x0, 0x0)
        /home/pmo/.local/share/go/pkg/mod/mvdan.cc/bitw@v0.0.0-20201128232643-ecb1d183db6c/main.go:268 +0xc9b
main.main1(0x824620, 0xc000128010, 0xc00007a058)
        /home/pmo/.local/share/go/pkg/mod/mvdan.cc/bitw@v0.0.0-20201128232643-ecb1d183db6c/main.go:53 +0xb7
main.main()
        /home/pmo/.local/share/go/pkg/mod/mvdan.cc/bitw@v0.0.0-20201128232643-ecb1d183db6c/main.go:46 +0x39
mvdan added a commit that referenced this issue Jul 24, 2021
Ciphers storing a credit or debit card don't have a "Login" object,
so we would panic in the "dump" command when attempting to print login
fields such as the URL or password.

For now, simply filter ciphers depending on whether Login exists. We
should probably improve this command in the future, but for now at least
it doesn't panic.

While at it, stop using tabwriter for it. First, if one has hundreds of
passwords stored, the command would seem to hang for tens of seconds,
decrypting all secrets before printing the whole aligned table. Now, it
prints each line as it goes. Not aligned anymore, but that's not a
terrible thing either - some URLs can be very long and mess up the output.

We also start obeying ^C properly in both the "dump" command and when
reading a password. Before the fix, both would simply keep going until
they were finished.

Finally, update deps.

Fixes #28.
@mvdan
Copy link
Owner

mvdan commented Jul 24, 2021

Ah, thanks for reporting - I can reproduce too. When I wrote the dump command, I only had passwords stored in bitwarden, so I didn't test other kinds of secrets. It seems like card ciphers don't have a "login" object, so we then panic.

I've sent a fix at #29; do you want to give it a go or review it?

@xPMo
Copy link
Author

xPMo commented Jul 26, 2021

The branch there works, thanks!

@mvdan mvdan closed this as completed in 9f9dffe Jul 26, 2021
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