nats-io/nsc

Segmentation violation from `nsc import account`

Closed this issue · 0 comments

Segmentation violation from nsc import account when no nsc environment has been set up. On nsc branch main. The error occurs before the specified jwt is checked for validity, so passing any file will cause the error.

root@instance:/# nsc import account --file $HOME/client_account.jwt
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4b6c58]

goroutine 1 [running]:
github.com/nats-io/nsc/v2/cmd/store.(*Store).IsManaged(...)
	/nsc/cmd/store/store.go:222
github.com/nats-io/nsc/v2/cmd.(*SignerParams).SetDefaults(0x4000157810, 0x70, 0x1?, {0x6e7be0?, 0x40001f2b70?})
	/nsc/cmd/signerparams.go:40 +0xd8
github.com/nats-io/nsc/v2/cmd.(*ImportAccount).SetDefaults(0x40001ee720?, {0x6e7be0?, 0x40001f2b70?})
	/nsc/cmd/importaccount.go:107 +0x38
github.com/nats-io/nsc/v2/cmd.run({0x6e7be0, 0x40001f2b70}, {0x5ab740?, 0x4000157810?})
	/nsc/cmd/action.go:120 +0x60
github.com/nats-io/nsc/v2/cmd.RunMaybeStorelessAction(0x40001ce900, {0x4000063b00?, 0x0, 0x2}, {0x5ab740, 0x4000157810})
	/nsc/cmd/action.go:95 +0x100
github.com/nats-io/nsc/v2/cmd.createImportAccountCmd.func1(0x40001ce900?, {0x4000063b00?, 0x2?, 0x2?})
	/nsc/cmd/importaccount.go:39 +0x2c
github.com/spf13/cobra.(*Command).execute(0x40001ce900, {0x4000063ae0, 0x2, 0x2})
	/root/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x5e0
github.com/spf13/cobra.(*Command).ExecuteC(0xa5ae00)
	/root/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x368
github.com/spf13/cobra.(*Command).Execute(...)
	/root/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
github.com/nats-io/nsc/v2/cmd.ExecuteWithWriter({0x6e23c0?, 0x4000010028?})
	/nsc/cmd/root.go:228 +0x6c
github.com/nats-io/nsc/v2/cmd.Execute()
	/nsc/cmd/root.go:216 +0x40
main.main()
	/nsc/main.go:34 +0xd4