Skip to content

Commit f1965d3

Browse files
add new transport version
1 parent 65aebd2 commit f1965d3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ static TransportVersion def(int id) {
275275
public static final TransportVersion ESQL_LIMIT_ROW_SIZE = def(9_085_0_00);
276276
public static final TransportVersion ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY = def(9_086_0_00);
277277
public static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES = def(9_087_0_00);
278+
public static final TransportVersion SECURITY_CLOUD_API_KEY_REALM_AND_TYPE = def(9_088_0_00);
278279

279280
/*
280281
* STOP! READ THIS FIRST! No, really,

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/Authentication.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,16 @@ public Authentication maybeRewriteForOlderVersion(TransportVersion olderVersion)
267267
+ "]"
268268
);
269269
}
270+
if (isCloudApiKey() && olderVersion.before(TransportVersions.SECURITY_CLOUD_API_KEY_REALM_AND_TYPE)) {
271+
throw new IllegalArgumentException(
272+
"versions of Elasticsearch before ["
273+
+ TransportVersions.SECURITY_CLOUD_API_KEY_REALM_AND_TYPE.toReleaseVersion()
274+
+ "] can't handle cloud API key authentication and attempted to rewrite for ["
275+
+ olderVersion.toReleaseVersion()
276+
+ "]"
277+
);
278+
}
279+
270280
final Map<String, Object> newMetadata = maybeRewriteMetadata(olderVersion, this);
271281

272282
final Authentication newAuthentication;
@@ -632,6 +642,16 @@ private static void doWriteTo(Subject effectiveSubject, Subject authenticatingSu
632642
+ "]"
633643
);
634644
}
645+
if (effectiveSubject.getType() == Subject.Type.CLOUD_API_KEY
646+
&& out.getTransportVersion().before(TransportVersions.SECURITY_CLOUD_API_KEY_REALM_AND_TYPE)) {
647+
throw new IllegalArgumentException(
648+
"versions of Elasticsearch before ["
649+
+ TransportVersions.SECURITY_CLOUD_API_KEY_REALM_AND_TYPE.toReleaseVersion()
650+
+ "] can't handle cloud API key authentication and attempted to send to ["
651+
+ out.getTransportVersion().toReleaseVersion()
652+
+ "]"
653+
);
654+
}
635655
final boolean isRunAs = authenticatingSubject != effectiveSubject;
636656
if (isRunAs) {
637657
final User outerUser = effectiveSubject.getUser();

0 commit comments

Comments
 (0)