lyft / confidant

Confidant: your secret keeper. https://lyft.github.io/confidant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a CREDENTIAL_KEY_FORMAT_REGEX setting

mohsen1 opened this issue · comments

Keys like "my key" should not be allowed

Hm. Yeah. I actually didn't think they were allowed. Thanks for the bug report!

Hmmm. Is there a reason for this? I find it very hard to be able to organize credentials without some kind of structure (especially when keys have to be globally unique, and we have several hundred of them scattered across dozens of individual credentials), and so I've been using slashes to provide some level of organization. I understand that it makes it impossible to use key names as env vars, but that's not really necessary for the core functionality. Can this at least be made an option? (I was actually getting ready to submit a related feature request about disabling the existing behavior of lowercasing all credential pair keys, because there are some situations where case sensitivity for keys would be useful for me.)

The reason is mostly to ensure keys can be used as environment variables, but you're right in that it limits other use-cases. Let's add some config options for this. A regex for allowed chars would be good, with the default regex being set for valid environment variables. If we expose the regex to the angular interface we can also disable the code that forces chars to lowercase, since it'll show a warning dialog for invalid chars.

By adding a CREDENTIAL_KEY_FORMAT_REGEX setting, we can restrict the key format based on a regex, where the default would be the current format. To have no enforcement, the regex could be '/.*/'.

commented

Hi, Will this be implemented anytime soon? I would find this useful also.

We don't have this planned for the next quarter, but this is up for grabs if you'd like to take it. I might get some spare time in the next quarter to do this as unplanned work otherwise.