FalcoSuessgott / vkv

vkv enables you to list, compare, move, import, document, backup & encrypt secrets from a HashiCorp Vault KV engine
https://falcosuessgott.github.io/vkv/
MIT License
86 stars 9 forks source link

Export/import metadata #124

Open Abyss777 opened 1 year ago

Abyss777 commented 1 year ago

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 commented 1 year ago

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 commented 10 months ago

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

jsalatiel commented 7 months ago

Any progress, @FalcoSuessgott ?

FalcoSuessgott commented 7 months ago

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 commented 7 months ago

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

jsalatiel commented 6 months ago

News? ;)

FalcoSuessgott commented 6 months ago

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 commented 5 months ago

+1 for this feature. Awesome tool

jsalatiel commented 3 months ago

Hi @FalcoSuessgott , how's this going ?

FalcoSuessgott commented 3 months ago

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"
      }
    ]
  }
}