fishi0x01 / vsh

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

More sanity checks #13

Closed fishi0x01 closed 5 years ago

fishi0x01 commented 5 years ago

There are no checks if a given path does actually exist. That leads to errors:

http://localhost:8889 /> cd bogus
http://localhost:8889 /bogus/> ls
panic: Unknown KV Version '-1' for path 'bogus/'

goroutine 1 [running]:
github.com/fishi0x01/vsh/client.(*Client).kvPath(0xc00014a750, 0xc00001eb11, 0x6, 0x7c9776, 0xa, 0xc000179b40, 0xc000145170)
        /home/fishi/Workspaces/fishi0x01/vsh/client/util.go:36 +0x3ae
github.com/fishi0x01/vsh/client.(*Client).getKVMetaDataPath(...)
        /home/fishi/Workspaces/fishi0x01/vsh/client/util.go:44
github.com/fishi0x01/vsh/client.(*Client).listLowLevel(0xc00014a750, 0xc00001eb11, 0x6, 0x1, 0x2, 0xe, 0xc, 0xc000145190)
        /home/fishi/Workspaces/fishi0x01/vsh/client/list.go:11 +0x88
github.com/fishi0x01/vsh/client.(*Client).List(0xc00014a750, 0xc00001eb10, 0x7, 0x7, 0xc00001eb10, 0x7, 0xc000118a80, 0xc00015e230)
        /home/fishi/Workspaces/fishi0x01/vsh/client/client.go:125 +0x9b
github.com/fishi0x01/vsh/cli.(*ListCommand).Run(0xc00015e280, 0xc000192201, 0x1)
        /home/fishi/Workspaces/fishi0x01/vsh/cli/ls.go:57 +0x78
main.executor(0xc00001ec66, 0x2)
        /home/fishi/Workspaces/fishi0x01/vsh/main.go:86 +0x2a7
github.com/c-bata/go-prompt.(*Prompt).Run(0xc000182580)
        /home/fishi/Workspaces/fishi0x01/vsh/vendor/github.com/c-bata/go-prompt/prompt.go:85 +0x7f2
main.main()
        /home/fishi/Workspaces/fishi0x01/vsh/main.go:137 +0x51a