Skip to content

Conversation

michael-redpanda
Copy link
Contributor

This PR adds support for describe SR resource based ACLs via the DescribeACLs API. This adds a new tagged field to the describe_acls_request and describe_acls_response messages that is used to indicate whether or not the request is for describing SR ACLs or Kafka ACLs.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.2.x
  • v25.1.x
  • v24.3.x

Release Notes

  • None

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for describing Schema Registry (SR) ACLs through the DescribeACLs Kafka API by introducing a new tagged boolean field describe_registry_acls to differentiate between Kafka and SR ACL requests.

Key changes:

  • Added a new tagged field to describe_acls_request and describe_acls_response protocol messages
  • Modified ACL handling logic to route requests to appropriate resource type converters based on the new field
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/v/kafka/protocol/schemata/describe_acls_request.json Added DescribeRegistryAcls tagged boolean field to request schema
src/v/kafka/protocol/schemata/describe_acls_response.json Added DescribeRegistryAcls tagged boolean field to response schema
src/v/kafka/server/handlers/details/security.h Added to_registry_resource_type conversion function and updated filtering logic
src/v/kafka/server/handlers/describe_acls.cc Modified response handling to use appropriate resource type converter
src/v/kafka/server/tests/describe_acls_test.cc Added comprehensive test cases for SR ACL describe functionality
src/v/kafka/server/tests/BUILD Added build configuration for new test file


kafka::describe_acls_request req;
req.data.describe_registry_acls = false;
req.data.resource_type = 1;
Copy link
Preview

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Magic number 1 should be replaced with a named constant or enum value to improve code readability and maintainability.

Suggested change
req.data.resource_type = 1;
req.data.resource_type = kafka::resource_type::topic;

Copilot uses AI. Check for mistakes.

kafka::describe_acls_request req;
req.data.describe_registry_acls = false;
req.data.resource_type = 1;
req.data.resource_pattern_type = 1;
Copy link
Preview

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Magic number 1 should be replaced with a named constant or enum value to improve code readability and maintainability.

Suggested change
req.data.resource_pattern_type = 1;
req.data.resource_pattern_type = kafka::resource_pattern_type::literal;

Copilot uses AI. Check for mistakes.

req.data.describe_registry_acls = false;
req.data.resource_type = 1;
req.data.resource_pattern_type = 1;
req.data.operation = 1;
Copy link
Preview

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Magic number 1 should be replaced with a named constant or enum value to improve code readability and maintainability.

Suggested change
req.data.operation = 1;
req.data.operation = kafka::acl_operation::read;

Copilot uses AI. Check for mistakes.

req.data.resource_type = 1;
req.data.resource_pattern_type = 1;
req.data.operation = 1;
req.data.permission_type = 1;
Copy link
Preview

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Magic number 1 should be replaced with a named constant or enum value to improve code readability and maintainability.

Suggested change
req.data.permission_type = 1;
req.data.permission_type = kafka::acl_permission_type::allow;

Copilot uses AI. Check for mistakes.

BOOST_REQUIRE(!resp.data.describe_registry_acls);
BOOST_REQUIRE_EQUAL(resp.data.error_code, kafka::error_code::none);
BOOST_REQUIRE_EQUAL(resp.data.resources.size(), 1);
BOOST_REQUIRE_EQUAL(resp.data.resources[0].type, 2);
Copy link
Preview

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Magic number 2 should be replaced with a named constant or enum value to improve code readability and maintainability.

Suggested change
BOOST_REQUIRE_EQUAL(resp.data.resources[0].type, 2);
BOOST_REQUIRE_EQUAL(
resp.data.resources[0].type,
static_cast<int8_t>(security::resource_type::topic));

Copilot uses AI. Check for mistakes.

req.data.describe_registry_acls = false;
// Request SR_SUBJECT resource type, which is invalid if
// describe_registry_acls is false
req.data.resource_type = 100;
Copy link
Preview

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Magic number 100 should be replaced with a named constant or enum value to improve code readability and maintainability.

Suggested change
req.data.resource_type = 100;
req.data.resource_type = static_cast<int8_t>(security::resource_type::sr_subject);

Copilot uses AI. Check for mistakes.

req.data.describe_registry_acls = true;
// Request TOPIC resource type, which is invalid if describe_registry_acls
// is true
req.data.resource_type = 2;
Copy link
Preview

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Magic number 2 should be replaced with a named constant or enum value to improve code readability and maintainability.

Suggested change
req.data.resource_type = 2;
req.data.resource_type = static_cast<int8_t>(kafka::resource_type::topic);

Copilot uses AI. Check for mistakes.

@michael-redpanda
Copy link
Contributor Author

Force push:

  • Fixed lint issues

@michael-redpanda
Copy link
Contributor Author

Force push:

  • fixed bazel lint issue

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Aug 19, 2025

CI test results

test results on build#71012
test_class test_method test_arguments test_kind job_url test_status passed reason
DataMigrationsApiTest test_migrated_topic_data_integrity {"include_groups": true, "params": {"cancellation": null, "use_alias": true}, "transfer_leadership": true} integration https://buildkite.com/redpanda/redpanda/builds/71012#0198c3f2-b0ee-4fea-af12-c1d6b5f581ec FLAKY 19/20
PrefixTruncateRecoveryTest test_prefix_truncate_recovery {"acks": -1, "start_empty": false} integration https://buildkite.com/redpanda/redpanda/builds/71012#0198c3f2-b0f3-49c4-9839-682cd031ef88 FLAKY 20/21 upstream reliability is '99.71098265895954'. current run reliability is '95.23809523809523'. drift is 4.47289 and the allowed drift is set to 50. The test should PASS
WriteCachingFailureInjectionTest test_unavoidable_data_loss null integration https://buildkite.com/redpanda/redpanda/builds/71012#0198c3ef-9021-405d-9a18-8804794a70b6 FLAKY 19/21 upstream reliability is '99.72527472527473'. current run reliability is '90.47619047619048'. drift is 9.24908 and the allowed drift is set to 50. The test should PASS
test results on build#71110
test_class test_method test_arguments test_kind job_url test_status passed reason
DataMigrationsApiTest test_mount_inexistent null integration https://buildkite.com/redpanda/redpanda/builds/71110#0198c9d4-b881-44fb-bbe5-c42c894f9c8a FLAKY 20/21 upstream reliability is '100.0'. current run reliability is '95.23809523809523'. drift is 4.7619 and the allowed drift is set to 50. The test should PASS
ProducersAdminAPITest test_producers_state_api_during_load null integration https://buildkite.com/redpanda/redpanda/builds/71110#0198c9d6-60d8-410d-8756-b587186dfb8a FAIL 0/1
test results on build#71401
test_class test_method test_arguments test_kind job_url test_status passed reason
RandomNodeOperationsTest test_node_operations {"cloud_storage_type": 1, "compaction_mode": "sliding_window", "enable_failures": true, "mixed_versions": true, "with_iceberg": false} integration https://buildkite.com/redpanda/redpanda/builds/71401#0198e747-6cd7-4a6e-984f-cda43d10b9fc FLAKY 19/21 upstream reliability is '100.0'. current run reliability is '90.47619047619048'. drift is 9.52381 and the allowed drift is set to 50. The test should PASS

@michael-redpanda
Copy link
Contributor Author

Force push:

  • Defined constants for the wire value of SR_SUBJECT and SR_REGISTRY resources

Field used to indicate if DescribeAclsRequest or DescribeAclsResponse
contains only Schema Registry resources.

Signed-off-by: Michael Boquard <[email protected]>
@michael-redpanda
Copy link
Contributor Author

Force push:

  • Moved tagged field from base response to each individual resource response to indicate that the resource is a registry resource

@michael-redpanda
Copy link
Contributor Author

Force push:

  • Fixed lint error

oleiman
oleiman previously approved these changes Aug 25, 2025
Copy link
Member

@oleiman oleiman left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines 271 to 275
default:
vassert(false, "Request only for Schema Registry resources");
Copy link
Member

Choose a reason for hiding this comment

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

nitpick(pedantic): prefer exhaustive switch cases

Copy link
Member

@BenPope BenPope left a comment

Choose a reason for hiding this comment

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

This looks good to me.

I agree with exhaustive switch and use of constants.

@michael-redpanda
Copy link
Contributor Author

Force push:

  • Exhaustive switch

If this new tagged field is true, then return Schema Registry resources
in the DescribeAcls response.  Will also accept SR resource types if the
new tagged field is true.

Signed-off-by: Michael Boquard <[email protected]>
@michael-redpanda
Copy link
Contributor Author

Force push:

  • Fixed lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants