keybase / keybase/keybase-issues

(Linux, keybase 1.0.0-46) Unhandled exception when piping passphrase to keybase CLI tool

Open
#1,889 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
899
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Just trying some crazy things. Found an unhandled exception of some sort by attempting to pipe the passphrase into the keybase client:

DISPLAY= echo SeKrItKeYtHaTsHoUlDnOtBeShArEd | keybase login

This issue has nothing to do with whether that should work or not, but rather that it should be graceful about failing. The command results in the following rather large trace (but only if the client isn't already logged in):

keybase passphrase: panic: inappropriate ioctl for device

goroutine 30 [running]:
github.com/keybase/client/go/vendor/github.com/keybase/gopass.getch(0x16e3900)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/gopass/nix.go:13 +0x73
github.com/keybase/client/go/vendor/github.com/keybase/gopass.getPasswd(0xc8201bde00, 0x0, 0x0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/gopass/pass.go:22 +0x152
github.com/keybase/client/go/vendor/github.com/keybase/gopass.GetPasswd(0x0, 0x0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/gopass/pass.go:47 +0x39
github.com/keybase/client/go/minterm.(*MinTerm).PromptPassword(0xc8201c0b20, 0xc8201c0a20, 0x14, 0x0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/minterm/minterm.go:76 +0x12d
github.com/keybase/client/go/client.(*Terminal).PromptPassword(0xc8201c0220, 0xc8201c0a20, 0x14, 0x0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/client/terminal.go:51 +0x9e
github.com/keybase/client/go/client.(*Terminal).GetSecret(0xc8201c0220, 0xc820049b98, 0x0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/client/terminal.go:140 +0x201
github.com/keybase/client/go/client.(*SecretEntry).Get(0xc8201c0240, 0xc8200f8730, 0x42, 0x1075510, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/keybase/client/go/client/secret_entry.go:80 +0x2b2
github.com/keybase/client/go/client.SecretUI.GetSecret(0xc8200fdaf0, 0xc8200f8730, 0x42, 0x1075510, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/keybase/client/go/client/ui.go:584 +0x9f
github.com/keybase/client/go/client.SecretUI.ppprompt(0xc8200fdaf0, 0x1129db0, 0x12, 0xc8200f8730, 0x42, 0x1075510, 0xf, 0x16cef00, 0x0, 0x0, ...)
    /root/go/src/github.com/keybase/client/go/client/ui.go:714 +0x2e3
github.com/keybase/client/go/client.SecretUI.GetKeybasePassphrase(0xc8200fdaf0, 0x0, 0xc8201bdbf0, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/keybase/client/go/client/ui.go:670 +0x1dd
github.com/keybase/client/go/client.(*SecretUIServer).GetKeybasePassphrase(0xc82000f370, 0x7f70b9b841b8, 0xc8201be800, 0x0, 0xc8201bdbf0, 0x9, 0x0, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/keybase/client/go/client/secret.go:35 +0xad
github.com/keybase/client/go/protocol.SecretUiProtocol.func6(0x7f70b9b841b8, 0xc8201be800, 0xc3ff40, 0xc8201c0980, 0x0, 0x0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/protocol/keybase_v1.go:3926 +0x142
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*callRequest).Serve.func1(0xc82010f960, 0x7f70b9b83cd8, 0xc8201baff0, 0x0, 0x0, 0xc3ff40, 0xc8201c0980, 0x1281028, 0xc8201c0960, 0x7f70b9b83f60, ...)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/request.go:96 +0x1ef
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*callRequest).Serve
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/request.go:103 +0x270

goroutine 1 [chan receive]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*dispatch).Call(0xc820104800, 0x7f70b9b83f20, 0xc82000e3a0, 0x1129f70, 0x15, 0xc7eac0, 0xc82000b440, 0x0, 0x0, 0x7f70b9b83ec8, ...)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:147 +0x41e
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*Client).Call(0xc82000b420, 0x7f70b9b83f20, 0xc82000e3a0, 0x1129f70, 0x15, 0xc7eac0, 0xc82000b440, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/client.go:35 +0x281
github.com/keybase/client/go/protocol.LoginClient.Login(0x7f70b9b83ef8, 0xc82000b420, 0x7f70b9b83f20, 0xc82000e3a0, 0x0, 0x105dbb0, 0x7, 0x0, 0x0, 0x0, ...)
    /root/go/src/github.com/keybase/client/go/protocol/keybase_v1.go:2025 +0x1b6
github.com/keybase/client/go/client.(*CmdLogin).Run(0xc8201016c0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/client/cmd_login.go:52 +0x4b8
main.mainInner(0xc820116500, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/keybase/main.go:129 +0xdb4
main.main()
    /root/go/src/github.com/keybase/client/go/keybase/main.go:37 +0x52

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 5 [syscall]:
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
    /usr/local/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 18 [select]:
github.com/keybase/client/go/libkb.(*LoginState).requests(0xc8200fb2c0)
    /root/go/src/github.com/keybase/client/go/libkb/login_state.go:745 +0x6ed
created by github.com/keybase/client/go/libkb.NewLoginState
    /root/go/src/github.com/keybase/client/go/libkb/login_state.go:108 +0x29e

goroutine 19 [select]:
github.com/keybase/client/go/libkb.(*ConnectionManager).run(0xc820102480)
    /root/go/src/github.com/keybase/client/go/libkb/connmgr.go:72 +0x410
created by github.com/keybase/client/go/libkb.NewConnectionManager
    /root/go/src/github.com/keybase/client/go/libkb/connmgr.go:112 +0x1fe

goroutine 20 [select]:
github.com/keybase/client/go/libkb.(*NotifyRouter).run(0xc8200fb350)
    /root/go/src/github.com/keybase/client/go/libkb/notify_router.go:65 +0x21e
created by github.com/keybase/client/go/libkb.NewNotifyRouter
    /root/go/src/github.com/keybase/client/go/libkb/notify_router.go:44 +0x1c5

goroutine 21 [chan receive]:
main.HandleSignals()
    /root/go/src/github.com/keybase/client/go/keybase/main.go:156 +0x10e
created by main.main
    /root/go/src/github.com/keybase/client/go/keybase/main.go:36 +0x44

goroutine 7 [select, locked to thread]:
runtime.gopark(0x12830c0, 0xc82002a728, 0x10639b0, 0x6, 0x42e418, 0x2)
    /usr/local/go/src/runtime/proc.go:185 +0x163
runtime.selectgoImpl(0xc82002a728, 0x0, 0x18)
    /usr/local/go/src/runtime/select.go:392 +0xa64
runtime.selectgo(0xc82002a728)
    /usr/local/go/src/runtime/select.go:212 +0x12
runtime.ensureSigM.func1()
    /usr/local/go/src/runtime/signal1_unix.go:227 +0x353
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 22 [select]:
github.com/keybase/client/go/vendor/stathat.com/c/ramcache.(*Ramcache).cleanup(0xc82010cc00)
    /root/go/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:164 +0x12c
created by github.com/keybase/client/go/vendor/stathat.com/c/ramcache.New
    /root/go/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:44 +0x15c

goroutine 23 [select]:
github.com/keybase/client/go/vendor/stathat.com/c/ramcache.(*Ramcache).cleanup(0xc82010ccc0)
    /root/go/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:164 +0x12c
created by github.com/keybase/client/go/vendor/stathat.com/c/ramcache.New
    /root/go/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:44 +0x15c

goroutine 24 [select]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*dispatch).callLoop(0xc820104800)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:97 +0x365
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.newDispatch
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:56 +0x2b0

goroutine 25 [select]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*receiveHandler).taskLoop(0xc8201921b0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/receiver.go:89 +0x312
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.newReceiveHandler
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/receiver.go:82 +0x646

goroutine 26 [chan receive]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*framedMsgpackDecoder).Decode(0xc8201c0780, 0xc538c0, 0xc8201bdc00, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/codec.go:92 +0x92
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*packetHandler).getFrame(0xc8201c07a0, 0x53, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/packetizer.go:22 +0x7f
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*packetHandler).packetizeOne(0xc8201c07a0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/packetizer.go:53 +0x2f
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*packetHandler).Packetize(0xc8201c07a0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/packetizer.go:61 +0x35
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).run(0xc8201110e0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:115 +0x104
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).Run.func1()
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:104 +0x29
sync.(*Once).Do(0xc820111130, 0xc8201d0f78)
    /usr/local/go/src/sync/once.go:44 +0xe4
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).Run(0xc8201110e0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:105 +0xd8
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*Client).Call
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/client.go:33 +0x179

goroutine 27 [IO wait]:
net.runtime_pollWait(0x7f70b9b83930, 0x72, 0xc82000e230)
    /usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc82010f790, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc82010f790, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc82010f730, 0xc8201a9000, 0x1000, 0x1000, 0x0, 0x7f70bbbc5050, 0xc82000e230)
    /usr/local/go/src/net/fd_unix.go:232 +0x23a
net.(*conn).Read(0xc8200fe0e8, 0xc8201a9000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/net.go:172 +0xe4
bufio.(*Reader).fill(0xc82010cde0)
    /usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).ReadByte(0xc82010cde0, 0xc8201c0980, 0x0, 0x0)
    /usr/local/go/src/bufio/bufio.go:229 +0x7a
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*ioDecReader).readn1(0xc82018a780, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/decode.go:213 +0x3d
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*msgpackDecDriver).readNextBd(0xc8200f8690)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/msgpack.go:570 +0x3a
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*msgpackDecDriver).TryDecodeAsNil(0xc8200f8690, 0xc800000000)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/msgpack.go:598 +0x2f
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*Decoder).decode(0xc82018a700, 0xc538c0, 0xc8201bdc00)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/decode.go:1063 +0x67
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*Decoder).Decode(0xc82018a700, 0xc538c0, 0xc8201bdc00, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/decode.go:989 +0x74
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).readerLoop(0xc8201110e0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:142 +0x17d
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).(github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.readerLoop)-fm(0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:111 +0x2e
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.runInBg.func1(0xc82010d680, 0xc8201bda10)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/util.go:25 +0x1d
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.runInBg
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/util.go:26 +0x5d

goroutine 28 [select]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).writerLoop(0xc8201110e0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:160 +0x1fa
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).(github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.writerLoop)-fm(0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:112 +0x2e
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.runInBg.func1(0xc82010d6e0, 0xc8201bda20)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/util.go:25 +0x1d
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.runInBg
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/util.go:26 +0x5d

goroutine 9 [semacquire]:
sync.runtime_Semacquire(0xc820111134)
    /usr/local/go/src/runtime/sema.go:43 +0x26
sync.(*Mutex).Lock(0xc820111130)
    /usr/local/go/src/sync/mutex.go:82 +0x1c4
sync.(*Once).Do(0xc820111130, 0xc820027f88)
    /usr/local/go/src/sync/once.go:40 +0x62
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).Run(0xc8201110e0, 0x0, 0x0)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:105 +0xd8
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*Client).Call
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/client.go:33 +0x179

goroutine 10 [select]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*dispatch).handleCall.func1(0xc820092100, 0xc820104800, 0x1)
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:126 +0x3f9
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*dispatch).handleCall
    /root/go/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:134 +0x3d8

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Linux command with DISPLAY unset, then start at vendor/github.com/keybase/gopass/nix.go and follow the call through client/minterm/minterm.go, client/terminal.go, and client/cmd_login.go. Confirm that a non-terminal passphrase input produces a concise failure instead of a panic and stack trace.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.