fishi0x01 / vsh

vsh - HashiCorp Vault interactive shell and cli tool
MIT License
284 stars 12 forks source link

Top level auto-completion panic #17

Closed fishi0x01 closed 5 years ago

fishi0x01 commented 5 years ago

Top level query can lead to panic:

./vsh_linux_amd64 
Cannot auto-discover mount backends: Token does not have list permission on sys/mounts
https://*** /> cd secretspanic: Unknown KV Version '-1' for path 'secrets/'

goroutine 1 [running]:
github.com/fishi0x01/vsh/client.(*Client).kvPath(0xc0001484e0, 0xc000270007, 0x8, 0x7cd6da, 0xa, 0xc0005739b8, 0x446972)
        /home/fishi/Workspaces/fishi0x01/vsh/client/util.go:65 +0x3ae
github.com/fishi0x01/vsh/client.(*Client).getKVMetaDataPath(...)
        /home/fishi/Workspaces/fishi0x01/vsh/client/util.go:73
github.com/fishi0x01/vsh/client.(*Client).lowLevelType(0xc0001484e0, 0xc000270007, 0x8, 0x4464d7)
        /home/fishi/Workspaces/fishi0x01/vsh/client/type.go:25 +0x6b
github.com/fishi0x01/vsh/client.(*Client).listLowLevel(0xc0001484e0, 0xc000270007, 0x8, 0x1, 0x2, 0x2, 0xc000270006, 0x9)
        /home/fishi/Workspaces/fishi0x01/vsh/client/list.go:15 +0x5a
github.com/fishi0x01/vsh/client.(*Client).List(0xc0001484e0, 0xc000270006, 0x9, 0xc000270033, 0x8, 0xc000270006, 0x9, 0x6500000072)
        /home/fishi/Workspaces/fishi0x01/vsh/client/client.go:132 +0x9c
github.com/fishi0x01/vsh/completer.(*Completer).relativePathSuggestions(0xc0001500f0, 0xc000270033, 0x8, 0x0, 0x0, 0x1)
        /home/fishi/Workspaces/fishi0x01/vsh/completer/completer.go:74 +0x1d8
github.com/fishi0x01/vsh/completer.(*Completer).Complete(0xc0001500f0, 0xc000270010, 0xb, 0xb, 0x77d0e0, 0xacb501, 0xc000284000)
        /home/fishi/Workspaces/fishi0x01/vsh/completer/completer.go:141 +0x1f6
github.com/c-bata/go-prompt.(*CompletionManager).Update(...)
        /home/fishi/Workspaces/fishi0x01/vsh/vendor/github.com/c-bata/go-prompt/completion.go:69
github.com/c-bata/go-prompt.(*Prompt).Run(0xc00011c080)
        /home/fishi/Workspaces/fishi0x01/vsh/vendor/github.com/c-bata/go-prompt/prompt.go:95 +0x68d
main.main()
        /home/fishi/Workspaces/fishi0x01/vsh/main.go:165 +0x505