-
Notifications
You must be signed in to change notification settings - Fork 707
CORE-14878: Migrate "Users" Admin API v1 Security Endpoints to v2 ConnectRPC API #29174
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
Open
nguyen-andrew
wants to merge
13
commits into
redpanda-data:dev
Choose a base branch
from
nguyen-andrew:admin-api-v2-users
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
19881b0
admin: Add SCRAM credential management stubs in Admin API v2
nguyen-andrew 4e70125
dt/pb: Generate Ducktape protobuf clients
nguyen-andrew 39e94b5
admin: Implement SCRAM credential creation in Admin API v2
nguyen-andrew cd9b1c0
admin: Implement SCRAM credential retrieval in Admin API v2
nguyen-andrew 9a98801
admin: Implement SCRAM credential listing in Admin API v2
nguyen-andrew 9866728
admin: Implement SCRAM credential update in Admin API v2
nguyen-andrew 44c39b9
admin: Implement SCRAM credential deletion in Admin API v2
nguyen-andrew eed9680
admin/tests: unit tests for match_scram_credential
nguyen-andrew 001cadf
admin/tests: unit tests for validate_scram_credential_name
nguyen-andrew 09fcbb6
admin/tests: unit tests for validate_pb_scram_credential
nguyen-andrew 5f6021d
admin/tests: unit tests for convert_to_security_scram_credential
nguyen-andrew d0f6850
admin/tests: add unit tests for convert_to_pb_scram_credential
nguyen-andrew 12b732b
dt: Extend SCRAM tests to cover both v1 and v2 Admin APIs
nguyen-andrew 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 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
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
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,11 +21,62 @@ import "proto/redpanda/core/pbgen/rpc.proto"; | |||||||||
| import "google/api/field_behavior.proto"; | ||||||||||
| import "google/api/resource.proto"; | ||||||||||
| import "google/protobuf/timestamp.proto"; | ||||||||||
| import "google/protobuf/field_mask.proto"; | ||||||||||
|
|
||||||||||
| option (pbgen.cpp_namespace) = "proto::admin"; | ||||||||||
|
|
||||||||||
| // The SecurityService provides security-related operations. | ||||||||||
| service SecurityService { | ||||||||||
| // CreateScramCredential | ||||||||||
| // | ||||||||||
| // Create a SCRAM credential. | ||||||||||
| rpc CreateScramCredential(CreateScramCredentialRequest) | ||||||||||
| returns (CreateScramCredentialResponse) { | ||||||||||
| option (pbgen.rpc) = { | ||||||||||
| authz: SUPERUSER | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // GetScramCredential | ||||||||||
| // | ||||||||||
| // Retrieve a SCRAM credential. | ||||||||||
| rpc GetScramCredential(GetScramCredentialRequest) | ||||||||||
| returns (GetScramCredentialResponse) { | ||||||||||
| option (pbgen.rpc) = { | ||||||||||
| authz: SUPERUSER | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // ListScramCredentials | ||||||||||
| // | ||||||||||
| // List all SCRAM credentials. | ||||||||||
| rpc ListScramCredentials(ListScramCredentialsRequest) | ||||||||||
| returns (ListScramCredentialsResponse) { | ||||||||||
| option (pbgen.rpc) = { | ||||||||||
| authz: SUPERUSER | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // UpdateScramCredential | ||||||||||
| // | ||||||||||
| // Update a SCRAM credential. | ||||||||||
| rpc UpdateScramCredential(UpdateScramCredentialRequest) | ||||||||||
| returns (UpdateScramCredentialResponse) { | ||||||||||
| option (pbgen.rpc) = { | ||||||||||
| authz: SUPERUSER | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // DeleteScramCredential | ||||||||||
| // | ||||||||||
| // Delete a SCRAM credential. | ||||||||||
| rpc DeleteScramCredential(DeleteScramCredentialRequest) | ||||||||||
| returns (DeleteScramCredentialResponse) { | ||||||||||
| option (pbgen.rpc) = { | ||||||||||
| authz: SUPERUSER | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // CreateRole | ||||||||||
| // | ||||||||||
| // Create a new Role resource. | ||||||||||
|
|
@@ -134,6 +185,34 @@ service SecurityService { | |||||||||
| /* Resources */ | ||||||||||
| // ============================================= | ||||||||||
|
|
||||||||||
| // The ScramCredential resource used for SCRAM authentication. | ||||||||||
| message ScramCredential { | ||||||||||
| option (google.api.resource) = { | ||||||||||
| type: "redpanda.core.admin.SecurityService/ScramCredential" | ||||||||||
| pattern: "scram_credentials/{scram_credential}" | ||||||||||
| }; | ||||||||||
|
|
||||||||||
| // The name of the SCRAM credential. | ||||||||||
| string name = 1 [ | ||||||||||
| (google.api.field_behavior) = REQUIRED, | ||||||||||
| (google.api.field_behavior) = IMMUTABLE | ||||||||||
| ]; | ||||||||||
|
|
||||||||||
| // The SCRAM mechanism. | ||||||||||
| enum ScramMechanism { | ||||||||||
| SCRAM_MECHANISM_UNSPECIFIED = 0; | ||||||||||
| SCRAM_MECHANISM_SCRAM_SHA_256 = 1; | ||||||||||
| SCRAM_MECHANISM_SCRAM_SHA_512 = 2; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // The SCRAM mechanism used for this credential. | ||||||||||
| ScramMechanism mechanism = 2; | ||||||||||
|
|
||||||||||
| // The password for the SCRAM credential. | ||||||||||
| string password = 3 | ||||||||||
| [debug_redact = true, (google.api.field_behavior) = INPUT_ONLY]; | ||||||||||
|
Comment on lines
+211
to
+213
Contributor
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. I think we should also add a redpanda/proto/redpanda/core/admin/v2/shadow_link.proto Lines 466 to 469 in c3e36a2
I do think this may result in having to make controller updates to store the timestamp. |
||||||||||
| } | ||||||||||
|
|
||||||||||
| // The Role resource represents a security role with associated members. | ||||||||||
| message Role { | ||||||||||
| option (google.api.resource) = { | ||||||||||
|
|
@@ -155,6 +234,83 @@ message Role { | |||||||||
| /* RPC Requests and Responses */ | ||||||||||
| // ============================================= | ||||||||||
|
|
||||||||||
| // CreateScramCredentialRequest is the request for the CreateScramCredential | ||||||||||
| // RPC. | ||||||||||
| message CreateScramCredentialRequest { | ||||||||||
| // The SCRAM credential to create. | ||||||||||
| ScramCredential scram_credential = 1 | ||||||||||
| [(google.api.field_behavior) = REQUIRED]; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // CreateScramCredentialResponse is the response from the CreateScramCredential | ||||||||||
| // RPC. | ||||||||||
| message CreateScramCredentialResponse { | ||||||||||
| // The created SCRAM credential. | ||||||||||
| ScramCredential scram_credential = 1; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // GetScramCredentialRequest is the request for the GetScramCredential RPC. | ||||||||||
| message GetScramCredentialRequest { | ||||||||||
| // The name of the SCRAM credential to retrieve. | ||||||||||
| string name = 1 [ | ||||||||||
| (google.api.field_behavior) = REQUIRED, | ||||||||||
| (google.api.resource_reference) = { | ||||||||||
| type: "redpanda.core.admin.SecurityService/ScramCredential" | ||||||||||
| } | ||||||||||
| ]; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // GetScramCredentialResponse is the response from the GetScramCredential RPC. | ||||||||||
| message GetScramCredentialResponse { | ||||||||||
| // The requested SCRAM credential. | ||||||||||
| ScramCredential scram_credential = 1; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // ListScramCredentialsRequest is the request for the ListScramCredentials RPC. | ||||||||||
| message ListScramCredentialsRequest {} | ||||||||||
|
|
||||||||||
| // ListScramCredentialsResponse is the response from the ListScramCredentials | ||||||||||
| // RPC. | ||||||||||
| message ListScramCredentialsResponse { | ||||||||||
| // The list of SCRAM credentials. | ||||||||||
| repeated ScramCredential scram_credentials = 1; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // UpdateScramCredentialRequest is the request for the UpdateScramCredential | ||||||||||
| // RPC. | ||||||||||
| message UpdateScramCredentialRequest { | ||||||||||
| // The SCRAM credential to update. | ||||||||||
| ScramCredential scram_credential = 1 | ||||||||||
| [(google.api.field_behavior) = REQUIRED]; | ||||||||||
|
|
||||||||||
| // The list of fields to update | ||||||||||
| // See [AIP-134](https://google.aip.dev/134) for how to use `field_mask` | ||||||||||
| google.protobuf.FieldMask update_mask = 2; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // UpdateScramCredentialResponse is the response from the UpdateScramCredential | ||||||||||
| // RPC. | ||||||||||
| message UpdateScramCredentialResponse { | ||||||||||
| // The updated SCRAM credential. | ||||||||||
| ScramCredential scram_credential = 1; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // DeleteScramCredentialRequest is the request for the DeleteScramCredential | ||||||||||
| // RPC. | ||||||||||
| message DeleteScramCredentialRequest { | ||||||||||
| // The name of the SCRAM credential to delete. | ||||||||||
| string name = 1 [ | ||||||||||
| (google.api.field_behavior) = REQUIRED, | ||||||||||
| (google.api.resource_reference) = { | ||||||||||
| type: "redpanda.core.admin.SecurityService/ScramCredential" | ||||||||||
| } | ||||||||||
| ]; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // DeleteScramCredentialResponse is the response from the DeleteScramCredential | ||||||||||
| // RPC. | ||||||||||
| message DeleteScramCredentialResponse {} | ||||||||||
|
|
||||||||||
| // CreateRoleRequest is the request for the CreateRole RPC. | ||||||||||
| message CreateRoleRequest { | ||||||||||
| // The Role to create. | ||||||||||
|
|
||||||||||
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.
I wonder if it would be useful to extract this to a common area of security. Maybe a security_types.proto