Add gRPC size annotations; allow non-empty UAK for unrestricted

This commit is contained in:
Chris Eager authored and Chris Eager committed 2026-04-16 13:18:56 -05:00
1 parent c70674ed26
commit f7b928f1a8
3 files changed
+4 -5

No files matched your search

@@ -139,9 +139,8 @@ public class AccountAttributes {
@Schema(hidden = true)
public boolean isUnrestrictedUakValid() {
final boolean valid =
(unrestrictedUnidentifiedAccess && (unidentifiedAccessKey == null || unidentifiedAccessKey.length == 0))
|| (!unrestrictedUnidentifiedAccess && (unidentifiedAccessKey != null
final boolean valid = unrestrictedUnidentifiedAccess ||
(!unrestrictedUnidentifiedAccess && (unidentifiedAccessKey != null
&& unidentifiedAccessKey.length == 16));
Metrics.counter(UAK_VALIDATION_COUNTER_NAME,
@@ -197,7 +197,7 @@ message ConfigureUnidentifiedAccessRequest {
// anonymously (i.e. to retrieve keys or profiles or to send messages) unless
// unrestricted unidentified access is permitted. Must be present if
// unrestricted unidentified access is not allowed.
bytes unidentified_access_key = 1;
bytes unidentified_access_key = 1 [(require.exactlySize) = 0, (require.exactlySize) = 16];
// If `true`, any user may interact with this account anonymously without
// providing an unidentified access key. Otherwise, users must provide the
@@ -802,7 +802,7 @@ class AccountControllerTest {
Arguments.argumentSet("restricted, non-empty UAK", false, new byte[16], 204),
Arguments.argumentSet("unrestricted, empty UAK", true, new byte[0], 204),
Arguments.argumentSet("restricted, empty UAK", false, new byte[0], 422),
Arguments.argumentSet("unrestricted, non-empty UAK", true, new byte[16], 422)
Arguments.argumentSet("unrestricted, non-empty UAK", true, new byte[16], 204)
);
}