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

Wrap/Unwrap: Use the same GUI as in KV view to support multiline strings #28579

Open
Himura2la opened this issue Oct 3, 2024 · 5 comments · May be fixed by #29677
Open

Wrap/Unwrap: Use the same GUI as in KV view to support multiline strings #28579

Himura2la opened this issue Oct 3, 2024 · 5 comments · May be fixed by #29677

Comments

@Himura2la
Copy link

Himura2la commented Oct 3, 2024

Is your feature request related to a problem? Please describe.

I'm always frustrated when trying to send a multiline secret string to my colleague using a Wrap feature. The Wrap GUI enforces JSON markup, but does not provide JSON serializer:

image

Describe the solution you'd like

Since you force wrapped secrets to be JOSN, please replace the current Wrap/Unwrap view with a user-friendly view from the "Create Secret" page, where I can paste a multiline string as is and have them automatically serialized to JSON:

image

Describe alternatives you've considered

We have to use base64 or jq for multiline secrets on both sending and receiving sides.

@Himura2la Himura2la changed the title Wrap/Unwrap: Use the same GUI as in KV creation view to support multiline strings Wrap/Unwrap: Use the same GUI as in KV view to support multiline strings Oct 4, 2024
@Monkeychip
Copy link
Contributor

@Himura2la Does toggling the "JSON" view when creating a secret not solve your workflow? When you toggle the JSON option when creating a secret you should be able to paste the unwrapped json object and it will create a multi-line secret. Or is there another part of this workflow that this doesn't cover?

Image

@Himura2la
Copy link
Author

@Monkeychip, please, pay attention to the last sentence of the post. Yes, it's technically possible, but requires converting a multiline string into a JSON string.

Also, there's no option to switch JSON off in "Wrap Data" view, which is exactly what's the issue about.

@lane-wetmore
Copy link
Contributor

lane-wetmore commented Feb 13, 2025

Hi @Himura2la , just to confirm that we've understood correctly, could you provide an example to clarify what you mean by "multiline secret"?

@hellobontempo
Copy link
Contributor

I'm not sure if this helps your use case, but a potential workaround depending on your permissions (while we solve this in the wrap/unwrap tools workflow) is clicking "Wrap secret" in the "Copy" dropdown in the toolbar for the details view.

Image

@Himura2la
Copy link
Author

Himura2la commented Feb 14, 2025

@lane-wetmore, I mean any string with line breaks (and quotation marks and backslashes), which can't be directly copy-pasted as-is into a JSON string between quotation marks. For instance, if I need to store a YAML document, it's required to perform manual conversion:

    jq -Rs <<EOF
services:
  pgsql:
    image: postgres:alpine
    container_name: pgsql
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    ports:
      - "5432:5432"
    volumes:
      - data:/var/lib/postgresql/data
    restart: unless-stopped
volumes:
  data:
EOF

"services:\n  pgsql:\n    image: postgres:alpine\n    container_name: pgsql\n    environment:\n      - POSTGRES_DB=postgres\n      - POSTGRES_USER=postgres\n      - POSTGRES_PASSWORD=postgres\n    ports:\n      - \"5432:5432\"\n    volumes:\n      - data:/var/lib/postgresql/data\n    restart: unless-stopped\nvolumes:\n  data:\n"

# wrap/unwrap

    echo '"services:\n  pgsql:\n    image: postgres:alpine\n    container_name: pgsql\n    environment:\n      - POSTGRES_DB=postgres\n      - POSTGRES_USER=postgres\n      - POSTGRES_PASSWORD=postgres\n    ports:\n      - \"5432:5432\"\n    volumes:\n      - data:/var/lib/postgresql/data\n    restart: unless-stopped\nvolumes:\n  data:\n"' | jq -r .

services:
  pgsql:
    image: postgres:alpine
    container_name: pgsql
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    ports:
      - "5432:5432"
    volumes:
      - data:/var/lib/postgresql/data
    restart: unless-stopped
volumes:
  data:

or the same thing with base64 instead of jq

A real-world example is passing someone a private key in PEM format.

@lane-wetmore lane-wetmore linked a pull request Feb 19, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants