usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
27.01k stars 1.24k forks source link

Unable to manually update secret in GUI #2217

Closed sralloza closed 3 months ago

sralloza commented 6 months ago

I have checked the following:

Describe the bug

To update a normal variable you just need to click in the value column of the environments view. However secret variables can't be updated like so. To update a secret you need to first uncheck the Secret checkbox, update it and then enable the secret checkbox again.

Is this expected behaviour?

.bru file to reproduce the bug

environment bru file:

vars {
  baseUrl: https://example.com
}
vars:secret [
  access_token,
  admin_cli_password
]

Screenshots/Live demo link

image
krummbar commented 6 months ago

This is something that I found confusing as well. I think this should be editable even though the value is hidden. Assuming I'm screen sharing, I want to be able to change the value of the secret without showing everyone what I'm entering.

I've checked the cause for this. Looks like if it is set as secret, it renders a div instead of an SingleLineEditor. I can only guess, but probably the reason for this is due to the limitations of CodeMirror with masking capabilities.

I've experimented a little bit, I'm trying to use the SingleLineEditor but changing the rendered output. This seems to work, but currently it is not masking/unmasking immediately when I'm changing a variable type as secret or not. Also I've to check if this has some other implications.

krummbar commented 6 months ago

It's now working. If the solution looks fine I'll raise a PR later today. Still wanted to check its not interfering with existing functionality