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

Web UI does not trim leading/trailing whitespaces in a secret's key #6714

Closed
rebbuh opened this issue May 10, 2019 · 5 comments · Fixed by #23702
Closed

Web UI does not trim leading/trailing whitespaces in a secret's key #6714

rebbuh opened this issue May 10, 2019 · 5 comments · Fixed by #23702

Comments

@rebbuh
Copy link

rebbuh commented May 10, 2019

Describe the bug
The Web UI does not trim leading/trailing whitespaces in a secret's key. Consequently, there might be issues when accessing the key. These leading/trailing whitespaces are hard to detect in the UI, especially since the input fields have a custom style and padding.

To Reproduce
Steps to reproduce the behavior:

  1. Create a secret using the Web UI.
  2. Add a key-value pair including leading/trailing whitespaces in the key.
  3. Try to access the value via the API using the key without any leading/trailing whitespaces. It cannot be found.

Expected behavior
Trim leading/trailing whitespaces in keys. If this is not desired, consider to alert the user in the Web UI in such cases.
Also consider to alert the user if there are leading/trailing whitespaces in the corresponding value. However, trimming the value may not be beneficial (in general, modifying/normalizing passwords automatically is a bad idea).

Environment:

  • Vault Version: 0.10.3
@thomaswors
Copy link

thomaswors commented Mar 8, 2022

This seems to still be an issue in Vault 1.8.4+prem

In the UI, whitespace is shown:
image

When copying the raw values, whitespace is preserved:

# /etc/datadog-agent/conf.d/mongo.d/conf.yaml
init_config:
instances:
  - hosts:
      - 127.0.0.1:443
    username: datadog

When using Vault CLI and running read, the whitespace is lost:

# /etc/datadog-agent/conf.d/mongo.d/conf.yaml                   
                  init_config:                                                    
                  instances:                                                      
                  - hosts:                                                        
                  - 127.0.0.1:443                                                 
                  username: datadog   

When called down via Terraform, whitespace is lost:

# /etc/datadog-agent/conf.d/mongo.d/conf.yaml
init_config:
instances:
 - hosts:
 - 127.0.0.1:443
 username: datadog

@aphorise
Copy link
Contributor

aphorise commented Sep 2, 2022

I can confirm that this has been fixed since it was reported (unless I am testing incorrectly).

@rebbuh @thomaswors do you folks agree that it's okay to close?

@aphorise
Copy link
Contributor

aphorise commented Sep 5, 2022

Please reopen if I've misunderstood or tested incorrectly.

@aphorise aphorise closed this as completed Sep 5, 2022
@swamy-m-s
Copy link

on which version it has been fixed, we are using 1.11.9 and the issue still persist

@hsimon-hashicorp hsimon-hashicorp removed their assignment Sep 27, 2023
@Monkeychip
Copy link
Contributor

A validation message should show if the secret name/path contains a white space. This validation was added for version 1.9. See PR here.

However, there is currently no validation on a secret's key to check for whitespace. I will go ahead and make a ticket for this and try to get this validation pushed through. Thank you everyone for the discussion!

I'll go ahead and reopen this ticket.

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.

7 participants