Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to export a KV path due to a segmentation violation #74

Closed
nikita-petko opened this issue Nov 27, 2021 · 11 comments
Closed

Unable to export a KV path due to a segmentation violation #74

nikita-petko opened this issue Nov 27, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@nikita-petko
Copy link

When attempting export a specific path on vault, it will throw the following error:

[sudo] password for robloxadmin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0x8ad3d2]

goroutine 1 [running]:
github.com/jonasvinther/medusa/pkg/vaultengine.(*Client).SecretRead(0xc0000d1d08, 0xc0000831c0, 0x3f, 0xc00024f800)
        /home/runner/work/medusa/medusa/pkg/vaultengine/secret_read.go:54 +0x2b2
github.com/jonasvinther/medusa/pkg/vaultengine.(*Client).PathReader(0xc0000d1d08, 0xc0000d1b28, 0xc0000e2780, 0x2d, 0x0, 0x0)
        /home/runner/work/medusa/medusa/pkg/vaultengine/folder_export.go:79 +0x1c5
github.com/jonasvinther/medusa/pkg/vaultengine.(*Client).FolderExport(0xc0000d1d08, 0xc0000e2780, 0x2d, 0x10, 0xc0000e2780, 0x2d)
        /home/runner/work/medusa/medusa/pkg/vaultengine/folder_export.go:16 +0x69
github.com/jonasvinther/medusa/cmd.glob..func3(0xd375a0, 0xc0000dfa40, 0x1, 0x7, 0x0, 0x0)
        /home/runner/work/medusa/medusa/cmd/export.go:42 +0x3fe
github.com/spf13/cobra.(*Command).execute(0xd375a0, 0xc0000df9d0, 0x7, 0x7, 0xd375a0, 0xc0000df9d0)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:850 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0xd37060, 0xc00003a778, 0xc0000d1f78, 0x4062c5)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:895
github.com/jonasvinther/medusa/cmd.Execute(...)
        /home/runner/work/medusa/medusa/cmd/cmd.go:59
main.main()
        /home/runner/work/medusa/medusa/main.go:10 +0x32

There are 2 paths that have data in them
/secret/teams/neteng/grid-service-v2/release -- throws
/secret/teams/neteng/grid-service-v2/debug -- can be exported, despite it having the same KV layout

The export command is as follows:
./medusa export secret/teams/neteng/grid-service-v2/release --address="https://chi1-vault.simulprod.com" --token="s.token" --format="json" --insecure

It can export /debug but no /release

If you need any more information, please ask

@jonasvinther
Copy link
Owner

Hi @nkpetko
Can you post the structure of the secret that doesn't work? Please remember to anonymize any values :)
I would expext that the secrets on both release and debug looks equal in structure but contains different values.

@jonasvinther jonasvinther added the bug Something isn't working label Dec 15, 2021
@nikita-petko
Copy link
Author

nikita-petko commented Dec 16, 2021

It's a KV of the following for both:

KEY -------- VALUE
GroupName -> String
Name -> String
Updated -> String (In date-time format)

If anything else is needed please ask

@liyaka
Copy link

liyaka commented Feb 25, 2022

I get this error as well for many secrets, for example:

xxx:
 apikey-auth:
    zzzzz:
    {
      "API Address": null,
      "Header 1": "asd",
      "Header 2": null,
      "Header 3": null,
      "Value 1": "asd",
      "Value 2": null,
      "Value 3": null
    }

maybe null value is the problem?

@nikita-petko
Copy link
Author

@liyaka I figured it may have been a null value issue, I have a few KVs in the release side that are null but none in the debug side.

I will look into it a bit more.

@liyaka
Copy link

liyaka commented Feb 27, 2022

@nkpetko is there a chance it will be fixed any time soon?

@nikita-petko
Copy link
Author

@nkpetko is there a chance it will be fixed any time soon?

@liyaka if I can find the root issue, and also @jonasvinther pulls a PR I make then soon

@jonasvinther
Copy link
Owner

If we can verify that the issue is a null value, then It would make it much easier to make a fix for it. @liyaka I will try to import your datastructure today or tomorrow and see if I can reproduce the error. A fix should be easy to implement if that's the case.

@liyaka
Copy link

liyaka commented Feb 28, 2022

@jonasvinther i did more tests, it is definitely the null issue - in all cases when i had at least one secret that had a null inside, i got this error.
An example for a secret with null:
{
"Name": "hhh",
"Value": null
}

@jonasvinther
Copy link
Owner

@liyaka and @nkpetko please give release 0.3.3 a spin. I think I have managed to handle the nil values now. At least it works for my test cases.

@liyaka
Copy link

liyaka commented Mar 1, 2022

@jonasvinther Thank you! will test it later today

@liyaka
Copy link

liyaka commented Mar 1, 2022

@jonasvinther Works like charm! Thanks again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants