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

Export/import metadata #124

Open
Abyss777 opened this issue Feb 10, 2023 · 10 comments
Open

Export/import metadata #124

Abyss777 opened this issue Feb 10, 2023 · 10 comments

Comments

@Abyss777
Copy link

Hello

Is there a way to export and then import the metadata ?

I see it in base and markdown but don't see the metadata neither in json nor in yaml.

Is it possible?

@FalcoSuessgott
Copy link
Owner

Hi,

currently metadata is not being exported when using yaml or json output format. But this is something i have on my list.

I will see and let you knowhow big this change would be

@jsalatiel
Copy link

Hi @FalcoSuessgott , any news on this?
btw, amazing tool!

@jsalatiel
Copy link

Any progress, @FalcoSuessgott ?

@FalcoSuessgott
Copy link
Owner

You really need this hm? Let me see what i can do im currently traveling but let me see how big that change is :)

@jsalatiel
Copy link

For export, modifying and reimporting, losing the metadata is not good 😐
Tks for taking a look at it.

@jsalatiel
Copy link

News? ;)

@FalcoSuessgott
Copy link
Owner

I started already. Its a rather big change as I wanna migrate to the KV* functions offered from the hashicorp vault api package, but Im on it and it will be the next PR :) stay tuned

@nichcuta
Copy link

nichcuta commented May 9, 2024

+1 for this feature. Awesome tool

@jsalatiel
Copy link

Hi @FalcoSuessgott , how's this going ?

@FalcoSuessgott
Copy link
Owner

In #265 Im working on it. Its the biggest vkv rewrite yet and completely refactors the vault and printer package.
It will allow exporting all secret versions as well as its metadata.

Here are some examples:

> go run main.go export -p secret -f=detailed
secret/ [kv2] (key/value secret storage)
├── admin [key=value]
│   └── [Version 1 created 17 seconds ago]  
│       └── sub=***
│       
│   
├── demo
│   └── [Version 1 created 17 seconds ago]  
│       └── foo=***
│       
│   
└── sub
    ├── demo
    │   └── [Version 1 created 17 seconds ago]  
    │       ├── demo=****
    │       ├── password=********
    │       └── user=****
    │       
    │   
    └── sub2
        └── demo [admin=false key=value]
            ├── [Version 2 created 17 seconds ago]  
            │   ├── password=********
            │   ├── user=****
            │   └── foo=***
            │   
            └── [Version 1 created 17 seconds ago]  
                ├── user=****
                ├── foo=***
                └── password=********

json example

{
  "mount_path": "secret",
  "type": "kv2",
  "description": "key/value secret storage",
  "secrets": {
    "secret/admin": [
      {
        "data": {
          "sub": "***"
        },
        "custom_metadata": {
          "key": "value"
        },
        "version": 1,
        "version_created_time": "2024-07-09T00:45:14.808418553Z",
        "destroyed": false,
        "deletion_time": "0001-01-01T00:00:00Z"
      }
    ],
    "secret/demo": [
      {
        "data": {
          "foo": "***"
        },
        "custom_metadata": null,
        "version": 1,
        "version_created_time": "2024-07-09T00:45:14.743139124Z",
        "destroyed": false,
        "deletion_time": "0001-01-01T00:00:00Z"
      }
    ],
    "secret/sub/demo": [
      {
        "data": {
          "demo": "****",
          "password": "********",
          "user": "****"
        },
        "custom_metadata": null,
        "version": 1,
        "version_created_time": "2024-07-09T00:45:14.868330798Z",
        "destroyed": false,
        "deletion_time": "0001-01-01T00:00:00Z"
      }
    ],
    "secret/sub/sub2/demo": [
      {
        "data": {
          "foo": "***",
          "password": "********",
          "user": "****"
        },
        "custom_metadata": {
          "admin": "false",
          "key": "value"
        },
        "version": 1,
        "version_created_time": "2024-07-09T00:45:14.927410345Z",
        "destroyed": false,
        "deletion_time": "0001-01-01T00:00:00Z"
      },
      {
        "data": {
          "foo": "***",
          "password": "********",
          "user": "****"
        },
        "custom_metadata": {
          "admin": "false",
          "key": "value"
        },
        "version": 2,
        "version_created_time": "2024-07-09T00:45:14.986193205Z",
        "destroyed": false,
        "deletion_time": "0001-01-01T00:00:00Z"
      }
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants