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

Backport UI: KV version 2 advanced secret updates to 1.15.x (#25235) #25238

Merged
merged 10 commits into from
Feb 14, 2024

Conversation

hashishaw
Copy link
Collaborator

@hashishaw hashishaw commented Feb 6, 2024

Includes everything from #25235, as well as JSON obfuscation which was a precursor to the original work.

Defaults to obfuscated JSON view when complex, without disabling the JSON toggle
Screenshot 2024-02-06 at 13 49 18

Shows warning when entering a complex secret value on non-JSON interface
Screenshot 2024-02-06 at 13 49 46

hashishaw and others added 2 commits February 6, 2024 13:21
* Add obfuscation for JSON values on KV data view

* Show JSON editor by default if secret data is complex, but do not disable JSON toggle

* Add text object warning to kv object editor

* a11y fix: do not disable show diff toggle

* test and language cleanup

* update language

* Update tests for expected behavior

* language!

* Add changelog
@hashishaw hashishaw added this to the 1.15.6 milestone Feb 6, 2024
@hashishaw hashishaw changed the title UI: KV version 2 advanced secret updates (#25235) Backport UI: KV version 2 advanced secret updates to 1.15.x (#25235) Feb 6, 2024
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Feb 6, 2024
@@ -27,6 +27,14 @@
<Icon @name="reload" />
</button>
{{/if}}
{{#if (and @allowObscure @readOnly)}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From precursor work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from precursor work

* @param obj object
* @returns object
*/
export function obfuscateData(obj) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From precursor work

@@ -100,4 +100,25 @@ module('Integration | Component | json-editor', function (hooks) {
assert.dom('.CodeMirror-code').hasText(`1${this.example}`, 'Example is restored');
assert.strictEqual(this.value, null, 'Value is cleared on restore example');
});

test('obscure option works correctly', async function (assert) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From precursor work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From precursor work

Copy link

github-actions bot commented Feb 6, 2024

Build Results:
All builds succeeded! ✅

Copy link

github-actions bot commented Feb 14, 2024

CI Results:
All Go tests succeeded! ✅

@@ -0,0 +1,3 @@
```release-note:bug
ui: Fix copy button not working on masked input when value is not a string
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#25269 was reliant on changes made in #25235, so I just lumped them in together here so I wouldn't forget to open the backport for this after the JSON update backport was merged

<Toggle
@name="revealValues"
@checked={{this.revealValues}}
@size="small"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original doesn't have @size="small" - is this discrepancy intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in 1.15 Toggle does not default to small size so we have to pass it

@@ -36,7 +36,7 @@
{{/if}}
{{#if @allowCopy}}
<CopyButton
@clipboardText={{@value}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I don't think this needs to be updated for CopyButton just Hds::CopyButton which was implemented in 1.16

It doesn't hurt to format 🤔 - mostly an FYI!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked before I made this backport that it was still failing for objects. Otherwise I'd love to not need this backport 😂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@hashishaw hashishaw merged commit 5d3dbf9 into release/1.15.x Feb 14, 2024
24 checks passed
@hashishaw hashishaw deleted the ui/backport-pr-25235-1.15.x branch February 14, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants