Gimini-3 commented on code in PR #23128:
URL: https://github.com/apache/kafka/pull/23128#discussion_r4013735864
##########
metadata/src/main/java/org/apache/kafka/metadata/ScramCredentialData.java:
##########
@@ -40,21 +46,36 @@ public static ScramCredentialData fromRecord(
record.iterations());
}
+ @Override
+ public byte[] salt() {
+ return Arrays.copyOf(salt, salt.length);
+ }
+
+ @Override
+ public byte[] storedKey() {
+ return Arrays.copyOf(storedKey, storedKey.length);
+ }
+
+ @Override
+ public byte[] serverKey() {
+ return Arrays.copyOf(serverKey, serverKey.length);
+ }
+
public UserScramCredentialRecord toRecord(
String userName,
ScramMechanism mechanism
) {
return new UserScramCredentialRecord().
setName(userName).
setMechanism(mechanism.type()).
- setSalt(salt).
- setStoredKey(storedKey).
- setServerKey(serverKey).
+ setSalt(salt()).
+ setStoredKey(storedKey()).
+ setServerKey(serverKey()).
setIterations(iterations);
}
public ScramCredential toCredential() {
- return new ScramCredential(salt, storedKey, serverKey, iterations);
+ return new ScramCredential(salt(), storedKey(), serverKey(),
iterations);
Review Comment:
Thanks, @kevin-wu24. I’ve reverted the defensive array copies in
`ScramCredentialData`, including the accessor and conversion changes, and
removed their regression tests. This PR is now scoped to `ScramImage` mechanism
maps; credential array behavior is unchanged. I updated the PR title and
description to reflect that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]