Fix panic in CertAuthority.Clone because of non-UTC times.#12057
Merged
espadolini merged 10 commits intomasterfrom Apr 20, 2022
Merged
Fix panic in CertAuthority.Clone because of non-UTC times.#12057espadolini merged 10 commits intomasterfrom
CertAuthority.Clone because of non-UTC times.#12057espadolini merged 10 commits intomasterfrom
Conversation
rosstimothy
approved these changes
Apr 19, 2022
zmb3
approved these changes
Apr 19, 2022
jakule
reviewed
Apr 19, 2022
| require.Zero(t, offset) | ||
|
|
||
| // successfully Clone without panic, see https://github.com/gogo/protobuf/issues/519 | ||
| _ = caUTC.Clone() |
Contributor
There was a problem hiding this comment.
Maybe require.NotPanics()??
espadolini
added a commit
that referenced
this pull request
Apr 20, 2022
espadolini
added a commit
that referenced
this pull request
Apr 20, 2022
espadolini
added a commit
that referenced
this pull request
Apr 20, 2022
This was referenced Apr 20, 2022
Closed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As reported by @eric-belhomme on the Teleport Community slack, ever since we've been using the gogoproto
Clonefortypes.CertAuthority, we've been hitting a panic on every code path that does aCloneon aCertAuthoritythat has aRotation.LastRotatedfield stored with a non-zero (non-UTC) offset - for instance, when attempting to begin a CA rotation. This is caused by gogo/protobuf#519.Other times stored in the CA, as far as I can tell, have always been stored as UTC, and after #9316 we have been also storing
LastRotatedas UTC (released in v8.1.3, v7.3.13 and v6.2.27).This affects every cluster that has completed a rotation before #9316, with a non-UTC local time on the auth server. This PR makes it so that times are loaded as UTC after unmarshaling (similarly to #5712), which doesn't otherwise change any behavior, and doesn't require any changes in the backend.