adobe / cryptr

Cryptr: a GUI for Hashicorp's Vault

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PEM format files not retaining format when pasting into Cryptr

kangman opened this issue · comments

The problem

When pasting PEM formatted files the UI does not retain the newline format causing the file format to be incorrect

Environment

  • Cryptr version (or git revision) that exhibits the issue:
  • Desktop OS/version used to run Cryptr: v0.3.0
  • Vault version: v1.3.0

Details

When trying to store ssl files

  • csr
  • crt
  • private key

the pem format \n is lost when pasting into the cryptr app

One workaround was to regex the \n into the output of the file

awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' cert-name.crt
--

then paste that into the json view of cryptr. When using the other UI an extra \ is appended with \\n as the output.

Steps to Reproduce

  1. Have a pem formated file
  2. copy paste the output to cryptr UI
  3. then copy paste that saved information to another file or editor and see the format change.

Hey, thanks for the bug report.

This is the current behavior because the input field in use is a traditional HTML input field, which are only ever a single line. Some whitespace characters may be preserved, but notably newlines cannot due to the object type. The way to fix this would be with a textarea element, which allows for multiple lines, and therefore supports newlines.

Moving to textarea objects is desired, but must be part of a larger effort to revamp the way secret key/value pairs are displayed and interacted with. I'm making a note to address this then.

In the mean time, feel free to use JSON mode. Newlines will properly be converted to a "\n" there, and is preserved thereafter in all operations, as at that point the input field only sees a single line of text.

Closing as this will need to be in a larger effort to change the display mechanisms. Thanks!