Skip to content

KAFKA-20921: Make SCRAM metadata deeply immutable - #23128

Open
Gimini-3 wants to merge 1 commit into
apache:trunkfrom
Gimini-3:KAFKA-20921-scram-metadata-immutability
Open

KAFKA-20921: Make SCRAM metadata deeply immutable#23128
Gimini-3 wants to merge 1 commit into
apache:trunkfrom
Gimini-3:KAFKA-20921-scram-metadata-immutability

Conversation

@Gimini-3

Copy link
Copy Markdown

This change makes SCRAM metadata images deeply immutable.

ScramImage previously wrapped only the outer mechanisms map without copying it, leaving constructor aliases and nested credential maps mutable. ScramCredentialData also retained and exposed its byte[] components through constructors, accessors, and conversion methods.

The change:

  • snapshot-copies and wraps the outer and nested mechanism maps;
  • defensively copies SCRAM credential arrays at construction and export boundaries;
  • adds regression tests covering constructor inputs, accessors, nested maps, toRecord(), and toCredential().

Related work: KAFKA-19305 mentioned ScramImage immutability, but PR #19847 only updated ClientQuotaImage and TopicImage.

Validation:

  • ./gradlew :metadata:spotlessCheck
  • ./gradlew :metadata:test

This contribution is my original work and I license it to the project under the project's open source license.

@github-actions github-actions Bot added triage PRs from the community kraft labels Aug 11, 2026
@Gimini-3
Gimini-3 marked this pull request as ready for review August 11, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kraft triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant