Skip to content

nats auth - incompatibilities with nsc created operators/accounts #1698

Description

@roeschter

Observed behavior

We see nil pointer check failures in a few places involving key management. Specifically scoped signing keys.
I would seem nats auth cannot handle that the list of scoped signing keys is empty (if the account was created by nsc).

Tested on local compile of main branch

Case 1) (reproducible)
Create an operator with

  1. nsc add operator --name TEST --sys
  2. Run nats auth accounts keys ls (selecting the SYS account)

`panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x68 pc=0x7ff6d8f6f634]

goroutine 1 [running]:
github.com/nats-io/natscli/cli.(*authAccountCommand).skListAction(0xc000515980?, 0x7ff6d85b77df?)
D:/private/nats.io_synadia/natscli/cli/auth_account_command.go:685 +0x254
github.com/choria-io/fisk.(*actionMixin).applyActions(...)
C:/Users/micha/go/pkg/mod/github.com/choria-io/fisk@v0.9.1-0.20260703081120-1be688c199d2/actions.go:28
github.com/choria-io/fisk.(*Application).applyActions(0xc0006cc000?, 0xc0004442d0)
C:/Users/micha/go/pkg/mod/github.com/choria-io/fisk@v0.9.1-0.20260703081120-1be688c199d2/app.go:842 +0xd0
github.com/choria-io/fisk.(*Application).execute(0xc0006cc000, 0xc0004442d0, {0xc0002700c0, 0x4, 0x4})
C:/Users/micha/go/pkg/mod/github.com/choria-io/fisk@v0.9.1-0.20260703081120-1be688c199d2/app.go:643 +0x65
github.com/choria-io/fisk.(*Application).Parse(0xc0006cc000, {0xc00004a090?, 0x38?, 0x7ff6d85bb9f3?})
C:/Users/micha/go/pkg/mod/github.com/choria-io/fisk@v0.9.1-0.20260703081120-1be688c199d2/app.go:300 +0x17f
github.com/choria-io/fisk.(*Application).MustParseWithUsage(0xc0006cc000, {0xc00004a090, 0x4, 0x7})
C:/Users/micha/go/pkg/mod/github.com/choria-io/fisk@v0.9.1-0.20260703081120-1be688c199d2/app.go:908 +0x45
main.main()
D:/private/nats.io_synadia/natscli/nats/main.go:105 +0x3cde `

Case 2) (cannot reproduce from scratch, likely same or similar issue)

When running user create with a signing key passed in
nats auth user add <name> <account> --operator <op> --key <accountSigningKey>

panic: runtime error: invalid memory address or nil pointer dereference
github.com/nats-io/natscli/internal/auth.SelectSigningKey(...)  internal/auth/auth.go:281
github.com/nats-io/natscli/cli.(*authUserCommand).addAction(...) cli/auth_user_command.go:36

Expected behavior

nats auth should work (create users) and certainly not crash when using an nsc created store/key setup.

Server and client version

nats CLI from main branch (July 14th 2026)
0.4.0 has a bug that was fixed two weeks ago, which casue panic even earlier when using an nsc created operator

Host environment

No response

Steps to reproduce

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSuspected defect such as a bug or regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions