-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Wrap secrets #5664
Merged
Merged
Wrap secrets #5664
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
62e4133
add menu for copying secrets, implement copying json of secret
f867433
add wrapped secret copy funcitonality
6a57da6
add wrap details tab to tools unwrap page
8345e5c
add menu for copying secrets, implement copying json of secret
46de9c8
add wrapped secret copy funcitonality
a9452b2
add wrap details tab to tools unwrap page
1b5f1d8
wrap secrets properly for kv v2
277f84b
use clipboard polyfill to copy wrapped
a319610
fix conflict
618f320
Merge branch 'master' of github.com:hashicorp/vault into wrap-secrets
d88b340
resolve merge nonsense
0d7922a
tidy up styling for unwrap page
953424a
use modelForData
df3f893
simplify copy dropdown, break wrapping into two steps
6111d62
upgrade yarn and regenerate yarn.lock
0a4947e
only allow copy for secret versions that are not deleted or destroyed
055933f
show None and No next to wrap details that don't exist
adc5a01
Merge branch 'master' into wrap-secrets
madalynrose ad94214
Merge branch 'master' into wrap-secrets
madalynrose a93c347
Merge branch 'master' into wrap-secrets
madalynrose a040d28
reset packages, toggle isWrapping even if it errors
4b123f0
Merge branch 'wrap-secrets' of github.com:hashicorp/vault into wrap-s…
0feb677
simplify showWrapButton logic, change unwrap tabs to buttons
1607e5f
Merge branch 'master' into wrap-secrets
madalynrose 4d64235
Merge branch 'master' into wrap-secrets
madalynrose 30a384d
Merge branch 'master' into wrap-secrets
madalynrose 1925af7
Merge branch 'master' into wrap-secrets
madalynrose 286ac71
Merge branch 'master' into wrap-secrets
madalynrose a3f254d
Merge branch 'master' into wrap-secrets
madalynrose ff9ef07
Merge branch 'master' of github.com:hashicorp/vault into wrap-secrets
096d536
evaluate showing wrap secret button on wrapped data
309bc1a
Merge branch 'master' into wrap-secrets
madalynrose 76ea70d
oops lost data-test attributes on merge
a82f0c2
Merge branch 'master' into wrap-secrets
madalynrose 5af1563
Merge branch 'master' into wrap-secrets
madalynrose File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ const DEFAULTS = { | |
creation_ttl: null, | ||
data: '{\n}', | ||
unwrap_data: null, | ||
details: null, | ||
wrapTTL: null, | ||
sum: null, | ||
random_bytes: null, | ||
|
@@ -33,6 +34,7 @@ export default Component.extend(DEFAULTS, { | |
algorithm: 'sha2-256', | ||
|
||
tagName: '', | ||
unwrapActiveTab: 'data', | ||
|
||
didReceiveAttrs() { | ||
this._super(...arguments); | ||
|
@@ -76,7 +78,13 @@ export default Component.extend(DEFAULTS, { | |
let props = {}; | ||
let secret = (resp && resp.data) || resp.auth; | ||
if (secret && action === 'unwrap') { | ||
props = assign({}, props, { unwrap_data: secret }); | ||
let details = { | ||
'Request ID': resp.request_id, | ||
'Lease ID': resp.lease_id || 'None', | ||
Renewable: resp.renewable ? 'Yes' : 'No', | ||
'Lease Duration': resp.lease_duration || 'None', | ||
}; | ||
props = assign({}, props, { unwrap_data: secret }, { details: details }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You won't need these changes if we move to reading with |
||
} | ||
props = assign({}, props, secret); | ||
if (resp && resp.wrap_info) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
<ConfirmAction | ||
@buttonClasses="button is-compact is-ghost has-icon-right" | ||
@onConfirmAction={{action "deleteKey"}} | ||
@confirmMessage={{if isV2 | ||
@confirmMessage={{if isV2 | ||
(concat "This will permanently delete " model.id " and all its versions. Are you sure you want to do this?") | ||
(concat "Are you sure you want to delete " model.id "?") | ||
}} | ||
|
@@ -53,43 +53,100 @@ | |
<label for="json" class="has-text-grey">JSON</label> | ||
</div> | ||
{{#if (and (eq mode 'show') (or canEditV2Secret canEdit))}} | ||
<div class="control"> | ||
{{#let (concat 'vault.cluster.secrets.backend.' (if (eq mode 'show') 'edit' 'show')) as |targetRoute|}} | ||
{{#if isV2}} | ||
<LinkTo | ||
@params={{array targetRoute model.id (query-params version=this.modelForData.version)}} | ||
@replace={{true}} | ||
class="link link-plain has-text-weight-semibold" | ||
> | ||
Create new version | ||
</LinkTo> | ||
{{else}} | ||
<LinkTo | ||
@params={{array targetRoute model.id}} | ||
@replace={{true}} | ||
class="link link-plain has-text-weight-semibold" | ||
> | ||
Edit Secret | ||
</LinkTo> | ||
{{/if}} | ||
{{/let}} | ||
</div> | ||
{{#unless (and isV2 (or modelForData.destroyed modelForData.deleted))}} | ||
<div class="control"> | ||
<BasicDropdown | ||
@class="popup-menu" | ||
@horizontalPosition="auto-right" | ||
@verticalPosition="below" | ||
@onClose={{action "clearWrappedData"}} | ||
as |D| | ||
> | ||
<D.trigger | ||
data-test-popup-menu-trigger="true" | ||
@class={{concat "link link-plain has-text-weight-semibold" (if D.isOpen " is-active")}} | ||
@tagName="button" | ||
> | ||
Copy Secret | ||
</D.trigger> | ||
<D.content @class="popup-menu-content is-wide"> | ||
<nav class="box menu"> | ||
<ul class="menu-list"> | ||
<li class="action"> | ||
<CopyButton | ||
@class="link link-plain has-text-weight-semibold is-ghost" | ||
@clipboardText={{codemirrorString}} | ||
@success={{action (set-flash-message "JSON Copied!")}} | ||
data-test-copy-button | ||
> | ||
Copy JSON | ||
</CopyButton> | ||
</li> | ||
<li class="action"> | ||
{{#if showWrapButton}} | ||
<button | ||
class="link link-plain has-text-weight-semibold is-ghost {{if isWrapping "is-loading"}}" | ||
type="button" | ||
{{action "handleWrapClick"}} | ||
data-test-wrap-button | ||
disabled={{isWrapping}} | ||
> | ||
Wrap Secret | ||
</button> | ||
{{else}} | ||
<MaskedInput | ||
@class="has-padding" | ||
@displayOnly={{true}} | ||
@allowCopy={{true}} | ||
@value={{wrappedData}} | ||
@success={{action "handleCopySuccess"}} | ||
@error={{action "handleCopyError"}} | ||
/> | ||
{{/if}} | ||
</li> | ||
</ul> | ||
</nav> | ||
</D.content> | ||
</BasicDropdown> | ||
</div> | ||
{{/unless}} | ||
<div class="control"> | ||
{{#if isV2}} | ||
<LinkTo | ||
@params={{array targetRoute model.id (query-params version=this.modelForData.version)}} | ||
@replace={{true}} | ||
class="link link-plain has-text-weight-semibold" | ||
> | ||
Create new version | ||
</LinkTo> | ||
{{else}} | ||
<LinkTo | ||
@params={{array targetRoute model.id}} | ||
@replace={{true}} | ||
class="link link-plain has-text-weight-semibold" | ||
> | ||
Edit Secret | ||
</LinkTo> | ||
{{/if}} | ||
</div> | ||
{{/let}} | ||
{{/if}} | ||
{{#if (and (eq @mode "show") this.isV2)}} | ||
<div class="control"> | ||
<SecretVersionMenu @version={{this.modelForData}} /> | ||
</div> | ||
<div class="control"> | ||
<BasicDropdown | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yikes not sure why I had all of this trailing whitespace the first time |
||
@class="popup-menu" | ||
@horizontalPosition="auto-right" | ||
@verticalPosition="below" | ||
<BasicDropdown | ||
@class="popup-menu" | ||
@horizontalPosition="auto-right" | ||
@verticalPosition="below" | ||
as |D| | ||
> | ||
<D.trigger | ||
<D.trigger | ||
data-test-popup-menu-trigger="true" | ||
@class={{concat "popup-menu-trigger button is-ghost has-text-grey" (if D.isOpen " is-active")}} | ||
@tagName="button" | ||
@class={{concat "popup-menu-trigger button is-ghost has-text-grey" (if D.isOpen " is-active")}} | ||
@tagName="button" | ||
> | ||
History <ICon @glyph="chevron-right" @size="11" /> | ||
</D.trigger> | ||
|
@@ -101,8 +158,8 @@ | |
@mode="versions" | ||
@secret={{this.model.id}} | ||
@class="has-text-black has-text-weight-semibold has-bottom-shadow" | ||
> | ||
View version history | ||
> | ||
View version history | ||
</SecretLink> | ||
</li> | ||
</ul> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this get reset or nulled out somewhere? Just thinking through how/why it doesn't stay through multiple popup openings.