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

Get local authorities to attributes #43

Merged
merged 3 commits into from
Jun 29, 2023

Conversation

MarcosDY
Copy link
Collaborator

Update get local authorities to return authorities by state instead of a list

…f a list

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
@@ -128,7 +140,19 @@ message RevokeJWTAuthorityResponse {
message GetX509AuthorityStateRequest {}

message GetX509AuthorityStateResponse {
repeated AuthorityState states = 1;
// Autority currently beign used for signing operations.
AuthorityState Active = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
AuthorityState Active = 1;
AuthorityState active = 1;

@@ -83,7 +83,19 @@ service LocalAuthority {
message GetJWTAuthorityStateRequest {}

message GetJWTAuthorityStateResponse {
repeated AuthorityState states = 1;
// Autority currently beign used for signing operations.
Copy link
Member

@azdagron azdagron Jun 22, 2023

Choose a reason for hiding this comment

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

Suggested change
// Autority currently beign used for signing operations.
// Authority currently being used for signing operations.

@@ -128,7 +140,19 @@ message RevokeJWTAuthorityResponse {
message GetX509AuthorityStateRequest {}

message GetX509AuthorityStateResponse {
repeated AuthorityState states = 1;
// Autority currently beign used for signing operations.
Copy link
Member

@azdagron azdagron Jun 22, 2023

Choose a reason for hiding this comment

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

Suggested change
// Autority currently beign used for signing operations.
// Authority currently being used for signing operations.

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
Copy link
Member

@azdagron azdagron left a comment

Choose a reason for hiding this comment

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

I don't see a reason to keep the "State" field in the AuthorityState message with these fields present. I also wonder if tainted should have its own field in the Get(X509|JWT)AuthorityState response (repeated AuthorityState tainted).

What's the criteria for something being old? How does that differ from prepared? And how do you distinguish? Is old just all non-active, non-tainted keys that are older than the active key?

Let's say we have the following keys, ordered by descending creation date.

K5
K4
K3
K2
K1

Anything newer than the active key set, that is also not tainted, is "prepared". So If K3 is "active", then K4 and K5 is "prepared". Anything older than the active key set, that is also not tainted, is "old" (well maybe... it might never have been used), so K2 and K1 are "old".

K5 <-- prepared
K4 <-- prepared
K3 <-- active
K2 <-- old
K1 <-- old

Now, we might constrain these buckets and say that there can be at most one "prepared" key, and only one "old" key by the way we construct our RPCs and state changes.

Seems like there can be any number of tainted keys.

Comment on lines 96 to 98
// Authority without state, This in an error condition and should
// never be encountered.
AuthorityState unknown = 4;
Copy link
Member

Choose a reason for hiding this comment

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

I don't see a good reason to return this. The caller can't do anything with it. If this situation was ever encountered, server logs would probably suffice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agree, there is no reason to return unknown authorities, even we must never get into this situation

Comment on lines 153 to 155
// Authority without state, This in an error condition and should
// never be encountered.
AuthorityState unknown = 4;
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as the unknown state in GetJWTAuthorityStateResponse

@MarcosDY
Copy link
Collaborator Author

What's the criteria for something being old? How does that differ from prepared? And how do you distinguish? Is old just all non-active, non-tainted keys that are older than the active key?

Old was previously activate, or just a Prepared key that moved into Old state in case we force to have a new Prepared key,
we can no longer rely on dates, since a use can play with running PrepareKey multiple times, and not forcing the rotation of the activate key.
So in SPIRE we must be sure we only have:
1 active
1 prepared
n old (on journal), but we must return only the newest OLD
n tainted keys (on datastore) but in the end we can only return 1 that is in OLD slot... this part is tricky...

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
Copy link
Member

@evan2645 evan2645 left a comment

Choose a reason for hiding this comment

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

Thanks @MarcosDY and @azdagron ❤️

@MarcosDY MarcosDY merged commit 08049db into spiffe:next Jun 29, 2023
@MarcosDY MarcosDY deleted the update-get-local-authority branch June 29, 2023 12:53
faisal-memon pushed a commit to faisal-memon/spire-api-sdk that referenced this pull request Jul 10, 2023
* Update get local authorities to return authorities by state instead of a list
* Remove Status from responses

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
MarcosDY added a commit to MarcosDY/spire-api-sdk that referenced this pull request Aug 16, 2023
* Update get local authorities to return authorities by state instead of a list
* Remove Status from responses

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
MarcosDY added a commit that referenced this pull request Aug 16, 2023
* Update get local authorities to return authorities by state instead of a list
* Remove Status from responses

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants