Skip to content

Bug fix: PKI ca cert field set initial value to 720hr#9465

Closed
Monkeychip wants to merge 4 commits into
masterfrom
pki-cert-ttl-fix
Closed

Bug fix: PKI ca cert field set initial value to 720hr#9465
Monkeychip wants to merge 4 commits into
masterfrom
pki-cert-ttl-fix

Conversation

@Monkeychip
Copy link
Copy Markdown
Contributor

We had originally added the intiailvalue on the pki-certificate file in this PR. However, this set all initial values used in the PKI to 720hr, which was problematic when you created a certificate after you created your CA certificate; naturally, it outlived your CA certificate.

To fix this we are now only set the initial value of ca certs to 720h, and everything else to 30hr.

Note: there is duplication between the TtlPicker2 components displayed when isCaCert is true and when isCaCert is false. We opted for the duplication instead of making a difficult to read inline conditional for the intialValue property, which is the only property that is different between the two.

@Monkeychip Monkeychip added ui bug Used to indicate a potential bug labels Jul 13, 2020
@Monkeychip Monkeychip added this to the 1.5 milestone Jul 13, 2020
Copy link
Copy Markdown
Contributor

@chelshaw chelshaw left a comment

Choose a reason for hiding this comment

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

I'm biased, but I think this looks good 😄

Comment thread ui/app/templates/partials/form-field-groups-loop.hbs Outdated
@helperTextDisabled="Vault will use the default lease duration"
@helperTextEnabled="Lease will expire after"
@description={{attr.helpText}}
@initialValue={{or (get model valuePath) attr.options.setDefault}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if the only thing that isCaCert changes is the initialValue, could initialValue be a computed property in the component? that'd keep this template a little cleaner. whaddya think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

heh, this idea is actually irrelevant given my other comment. i'll leave it here though just in case. :)

label: 'TTL',
editType: 'ttl',
defaultValue: '720h',
defaultValue: '30h',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

another option for solving this would be to that would keep the defaultValues set in the model and alleviate the need for computed properties in the component or conditionals in the template would be to overwrite ttl value that is extended inside the pki-ca-certificate model. i haven't tested it out but it's worth a shot! i think it's good to define values in the same source as much as possible. what are your thoughts?

Copy link
Copy Markdown
Contributor

@andaley andaley left a comment

Choose a reason for hiding this comment

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

i had one suggestion, and otherwise looks like the tests need to be updated/fixed. thanks for following up on this!

@Monkeychip
Copy link
Copy Markdown
Contributor Author

Closing for work that will change the workflow.

@Monkeychip Monkeychip closed this Jul 15, 2020
@Monkeychip Monkeychip deleted the pki-cert-ttl-fix branch June 7, 2022 20:48
brianwarner pushed a commit to fidelity-contributions/hashicorp-vault that referenced this pull request Sep 19, 2025
…hicorp#9343) (hashicorp#9465)

* Add O= restrictions in addition to OU= restrictions

* Add changelog

* Add goDoc to test

* Don't let test certificate expire.

Co-authored-by: Kit Haines <khaines@mit.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Used to indicate a potential bug ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants