panic: runtime error: invalid memory address or nil pointer dereference

AustinGray
AustinGray
Community Member

I had a team member here install the 1password cli. He went to the website, downloaded the latest release, did a mv of op to /usr/local/bin/op. He can do a --verison, but when he tries to run the very first login command, he gets the following error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1057650]

goroutine 1 [running]:
github.com/agilebits/op/command.(SigninCommand).Run(0xc42000c1c8, 0xc4200563c0, 0x3, 0x4, 0xc42010cac0)
/go/src/github.com/agilebits/op/command/signin.go:90 +0x3ee
github.com/agilebits/op/vendor/github.com/mitchellh/cli.(
CLI).Run(0xc42011c000, 0xc42011c000, 0x0, 0x0)
/go/src/github.com/agilebits/op/vendor/github.com/mitchellh/cli/cli.go:154 +0x16a
main.main()
/go/src/github.com/agilebits/op/main.go:22 +0x71

Any insight would be helpful, thank you!


1Password Version: CLI 0.4.1
Extension Version: Not Provided
OS Version: 10.12.6
Sync Type: Not Provided

Comments

  • AustinGray
    AustinGray
    Community Member

    Sorry, the OS version is macOS Sierra 10.12.6 - Also, it is installed on my machine and works fine. I am going to have the team member update their OS and see if that fixes it. Will follow up.

  • AustinGray
    AustinGray
    Community Member

    Ok we upgrade his OS to macOS 10.13.5 and still getting the same error. Trying a couple things.

  • Hi @AustinGray,

    Thanks for sharing this with us. Is it possible that the secret key is missing a character or something like that? Surely this is a bug on our side, but let's start by figuring out what's causing this and then we can look at fixing things up on our side.

    Are you able to run the same command on another Mac? Does it also crash if you just run something like op signin example? It should just tell you that it doesn't know what example is, but that would be getting further than a --help would.

    I'd ask you for the full command that is being run, but I suspect it contains the secret key and you don't want to be sharing that.

    Rick

  • AustinGray
    AustinGray
    Community Member

    Hi @rickfillion, thank you for your reply.

    It works perfectly on my machine: macOS High Sierra Version 10.13.4

    When running op signin example we get the message: "[LOG] 2018/06/21 09:19:34 (ERROR) Account example has never been signed into on this device, run 'op signin --help' to learn how to sign into an account for the first time"

    The full command that is being run is op signin <our-subdomain>.1password.com <user>@<our-domain>.com A3-XXXXXX-XXXXXX-XXXXX-XXXXX-XXXXX-XXXXX

    I just had him verify the secret key and it is correct. We are going to try downgrading the cli version and see if we get different results, will follow up. Thank you.

  • @AustinGray,

    If needed we could send you a build that has more symbols so that in the backtrace we could get a line number which would help shine a light on where things are going wrong.

    Rick

  • AustinGray
    AustinGray
    Community Member
    edited June 2018

    He downgraded to 0.4 and receives a different message: "[LOG] 2018/06/21 09:27:17 (ERROR) Cannot register device MachineName.local" - where MachineName is the actual name of his machine.

    @rickfillion that would be great, I really appreciate your time.

  • AustinGray
    AustinGray
    Community Member

    @rickfillion Just FYI - had another team member try it and he encountered zero issues. Will keep trying to determine what the conflict on this users machine may be.

  • cohix
    cohix
    1Password Alumni

    @AustinGray could you please check to see what the permissions are on ~/.op (directory) and ~/.op/.device (file) (and whether they exist at all) ?

    run la in the home dir and the .op dir and copy and paste the whole line for each, if you could please!

  • AustinGray
    AustinGray
    Community Member

    @cohix It was most certainly a permission issue. I had the user signing in via a script, but the script is executed with sudo for some other things to work. However, running that script was their first time using the cli, and therefor the .op directory must have been created by root. That was it! Thank you very much for your time and help @rickfillion and @cohix !!!

  • Good sleuthing, @AustinGray and @cohix!

    We'll make sure to get an issue filed on our end to do something better than crash in that situation.

    Rick

  • cohix
    cohix
    1Password Alumni

    @AustinGray glad to hear it! I've opened an issue to do better checking on the needed directories so we can fail gracefully in the future :)

  • DoubleWale
    DoubleWale
    Community Member

    I'm having issues running signing in with the cli as www-data. I've tried giving www-data a home directory and setting XDG_CONFIG_HOME via a fastconfig param but I'm still getting Golang errors: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x45a230].

    Any chance I can implement a stateless sign in method that returns a session without trying to save it. Would be perfect since I can already pass the session token in the --session flag for other commands.

    Thanks

  • ag_konstantin
    ag_konstantin
    1Password Alumni

    Hi @DoubleWale,

    Thanks for reaching out! I’ve raised an issue to better handle and report the error you have described.

    Unfortunately, currently we do not support stateless sign in method, as we have to store UUID associated with your account.

    Could you please confirm if there is an .op folder created under the folder you’ve configured in the XDG_CONFIG_HOME variable? Is there a config file inside of the .op folder? Essentially, the account your running CLI under needs to have writing permissions to XDG_CONFIG_HOME folder.

    Kind regards,
    Konstantin

  • DoubleWale
    DoubleWale
    Community Member

    @ag_konstantin a .op folder gets created in the home directory (XDG_CONFIG_HOME) of whatever user the cli runs with, just besides the www-data user. I'll work around it anyways.

    Thanks

  • ag_konstantin
    ag_konstantin
    1Password Alumni
    edited August 2018

    www-data is a default Apache web server account with a very strict set of permissions. Giving write permissions to www-data account opens up a system to a potential security breach.

This discussion has been closed.