Skip to content

Commit 0ba5c84

Browse files
committed
Merge with master
2 parents e6503ff + 57124d6 commit 0ba5c84

File tree

169 files changed

+3298
-3115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+3298
-3115
lines changed

.github/workflows/branch-testing.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: GitHub Actions Branch Testing
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'v1.*'
8+
schedule:
9+
- cron: '54 19 * * SUN' # weekly at a "random" time
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
arm64:
16+
runs-on: ubuntu-24.04-arm
17+
strategy:
18+
matrix:
19+
jre: [17]
20+
fail-fast: false # Should swap to true if we grow a large matrix
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-java@v4
25+
with:
26+
java-version: ${{ matrix.jre }}
27+
distribution: 'temurin'
28+
29+
- name: Gradle cache
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/.gradle/caches
34+
~/.gradle/wrapper
35+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
36+
restore-keys: |
37+
${{ runner.os }}-gradle-
38+
39+
- name: Build
40+
run: ./gradlew -Dorg.gradle.parallel=true -Dorg.gradle.jvmargs='-Xmx1g' -PskipAndroid=true -PskipCodegen=true -PerrorProne=false test
41+

MODULE.bazel

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ module(
22
name = "grpc-java",
33
compatibility_level = 0,
44
repo_name = "io_grpc_grpc_java",
5-
version = "1.71.0-SNAPSHOT", # CURRENT_GRPC_VERSION
5+
version = "1.72.0-SNAPSHOT", # CURRENT_GRPC_VERSION
66
)
77

88
# GRPC_DEPS_START
99
IO_GRPC_GRPC_JAVA_ARTIFACTS = [
1010
"com.google.android:annotations:4.1.1.4",
11-
"com.google.api.grpc:proto-google-common-protos:2.48.0",
11+
"com.google.api.grpc:proto-google-common-protos:2.51.0",
1212
"com.google.auth:google-auth-library-credentials:1.24.1",
1313
"com.google.auth:google-auth-library-oauth2-http:1.24.1",
1414
"com.google.auto.value:auto-value-annotations:1.11.0",
@@ -18,7 +18,8 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
1818
"com.google.errorprone:error_prone_annotations:2.30.0",
1919
"com.google.guava:failureaccess:1.0.1",
2020
"com.google.guava:guava:33.3.1-android",
21-
"com.google.re2j:re2j:1.7",
21+
"com.google.re2j:re2j:1.8",
22+
"com.google.s2a.proto.v2:s2a-proto:0.1.1",
2223
"com.google.truth:truth:1.4.2",
2324
"com.squareup.okhttp:okhttp:2.7.5",
2425
"com.squareup.okio:okio:2.10.0", # 3.0+ needs swapping to -jvm; need work to avoid flag-day
@@ -31,8 +32,8 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
3132
"io.netty:netty-handler-proxy:4.1.110.Final",
3233
"io.netty:netty-handler:4.1.110.Final",
3334
"io.netty:netty-resolver:4.1.110.Final",
34-
"io.netty:netty-tcnative-boringssl-static:2.0.65.Final",
35-
"io.netty:netty-tcnative-classes:2.0.65.Final",
35+
"io.netty:netty-tcnative-boringssl-static:2.0.70.Final",
36+
"io.netty:netty-tcnative-classes:2.0.70.Final",
3637
"io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.110.Final",
3738
"io.netty:netty-transport-native-unix-common:4.1.110.Final",
3839
"io.netty:netty-transport:4.1.110.Final",
@@ -48,6 +49,7 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
4849

4950
bazel_dep(name = "bazel_skylib", version = "1.7.1")
5051
bazel_dep(name = "googleapis", repo_name = "com_google_googleapis", version = "0.0.0-20240326-1c8d509c5")
52+
5153
# CEL Spec may be removed when cncf/xds MODULE is no longer using protobuf 27.x
5254
bazel_dep(name = "cel-spec", repo_name = "dev_cel", version = "0.15.0")
5355
bazel_dep(name = "grpc", repo_name = "com_github_grpc_grpc", version = "1.56.3.bcr.1")

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ For a guided tour, take a look at the [quick start
4444
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
4545
basics](https://grpc.io/docs/languages/java/basics).
4646

47-
The [examples](https://github.com/grpc/grpc-java/tree/v1.69.1/examples) and the
48-
[Android example](https://github.com/grpc/grpc-java/tree/v1.69.1/examples/android)
47+
The [examples](https://github.com/grpc/grpc-java/tree/v1.70.0/examples) and the
48+
[Android example](https://github.com/grpc/grpc-java/tree/v1.70.0/examples/android)
4949
are standalone projects that showcase the usage of gRPC.
5050

5151
Download
@@ -56,18 +56,18 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
5656
<dependency>
5757
<groupId>io.grpc</groupId>
5858
<artifactId>grpc-netty-shaded</artifactId>
59-
<version>1.69.1</version>
59+
<version>1.70.0</version>
6060
<scope>runtime</scope>
6161
</dependency>
6262
<dependency>
6363
<groupId>io.grpc</groupId>
6464
<artifactId>grpc-protobuf</artifactId>
65-
<version>1.69.1</version>
65+
<version>1.70.0</version>
6666
</dependency>
6767
<dependency>
6868
<groupId>io.grpc</groupId>
6969
<artifactId>grpc-stub</artifactId>
70-
<version>1.69.1</version>
70+
<version>1.70.0</version>
7171
</dependency>
7272
<dependency> <!-- necessary for Java 9+ -->
7373
<groupId>org.apache.tomcat</groupId>
@@ -79,18 +79,18 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
7979

8080
Or for Gradle with non-Android, add to your dependencies:
8181
```gradle
82-
runtimeOnly 'io.grpc:grpc-netty-shaded:1.69.1'
83-
implementation 'io.grpc:grpc-protobuf:1.69.1'
84-
implementation 'io.grpc:grpc-stub:1.69.1'
82+
runtimeOnly 'io.grpc:grpc-netty-shaded:1.70.0'
83+
implementation 'io.grpc:grpc-protobuf:1.70.0'
84+
implementation 'io.grpc:grpc-stub:1.70.0'
8585
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
8686
```
8787

8888
For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
8989
`grpc-protobuf-lite` instead of `grpc-protobuf`:
9090
```gradle
91-
implementation 'io.grpc:grpc-okhttp:1.69.1'
92-
implementation 'io.grpc:grpc-protobuf-lite:1.69.1'
93-
implementation 'io.grpc:grpc-stub:1.69.1'
91+
implementation 'io.grpc:grpc-okhttp:1.70.0'
92+
implementation 'io.grpc:grpc-protobuf-lite:1.70.0'
93+
implementation 'io.grpc:grpc-stub:1.70.0'
9494
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
9595
```
9696

@@ -99,7 +99,7 @@ For [Bazel](https://bazel.build), you can either
9999
(with the GAVs from above), or use `@io_grpc_grpc_java//api` et al (see below).
100100

101101
[the JARs]:
102-
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.69.1
102+
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.70.0
103103

104104
Development snapshots are available in [Sonatypes's snapshot
105105
repository](https://oss.sonatype.org/content/repositories/snapshots/).
@@ -131,7 +131,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use
131131
<configuration>
132132
<protocArtifact>com.google.protobuf:protoc:3.25.5:exe:${os.detected.classifier}</protocArtifact>
133133
<pluginId>grpc-java</pluginId>
134-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.69.1:exe:${os.detected.classifier}</pluginArtifact>
134+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.70.0:exe:${os.detected.classifier}</pluginArtifact>
135135
</configuration>
136136
<executions>
137137
<execution>
@@ -161,7 +161,7 @@ protobuf {
161161
}
162162
plugins {
163163
grpc {
164-
artifact = 'io.grpc:protoc-gen-grpc-java:1.69.1'
164+
artifact = 'io.grpc:protoc-gen-grpc-java:1.70.0'
165165
}
166166
}
167167
generateProtoTasks {
@@ -194,7 +194,7 @@ protobuf {
194194
}
195195
plugins {
196196
grpc {
197-
artifact = 'io.grpc:protoc-gen-grpc-java:1.69.1'
197+
artifact = 'io.grpc:protoc-gen-grpc-java:1.70.0'
198198
}
199199
}
200200
generateProtoTasks {

SECURITY.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ grpc-netty version | netty-handler version | netty-tcnative-boringssl-static ver
399399
1.57.x-1.58.x | 4.1.93.Final | 2.0.61.Final
400400
1.59.x | 4.1.97.Final | 2.0.61.Final
401401
1.60.x-1.66.x | 4.1.100.Final | 2.0.61.Final
402-
1.67.x | 4.1.110.Final | 2.0.65.Final
402+
1.67.x-1.70.x | 4.1.110.Final | 2.0.65.Final
403+
1.71.x- | 4.1.110.Final | 2.0.70.Final
403404

404405
_(grpc-netty-shaded avoids issues with keeping these versions in sync.)_
405406

alts/src/main/java/io/grpc/alts/AltsContextUtil.java

+35-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package io.grpc.alts;
1818

1919
import io.grpc.Attributes;
20+
import io.grpc.ClientCall;
2021
import io.grpc.ExperimentalApi;
2122
import io.grpc.ServerCall;
2223
import io.grpc.alts.internal.AltsInternalContext;
@@ -29,14 +30,36 @@ public final class AltsContextUtil {
2930
private AltsContextUtil() {}
3031

3132
/**
32-
* Creates a {@link AltsContext} from ALTS context information in the {@link ServerCall}.
33+
* Creates an {@link AltsContext} from ALTS context information in the {@link ServerCall}.
3334
*
3435
* @param call the {@link ServerCall} containing the ALTS information
3536
* @return the created {@link AltsContext}
3637
* @throws IllegalArgumentException if the {@link ServerCall} has no ALTS information.
3738
*/
3839
public static AltsContext createFrom(ServerCall<?, ?> call) {
39-
Object authContext = call.getAttributes().get(AltsProtocolNegotiator.AUTH_CONTEXT_KEY);
40+
return createFrom(call.getAttributes());
41+
}
42+
43+
/**
44+
* Creates an {@link AltsContext} from ALTS context information in the {@link ClientCall}.
45+
*
46+
* @param call the {@link ClientCall} containing the ALTS information
47+
* @return the created {@link AltsContext}
48+
* @throws IllegalArgumentException if the {@link ClientCall} has no ALTS information.
49+
*/
50+
public static AltsContext createFrom(ClientCall<?, ?> call) {
51+
return createFrom(call.getAttributes());
52+
}
53+
54+
/**
55+
* Creates an {@link AltsContext} from ALTS context information in the {@link Attributes}.
56+
*
57+
* @param attributes the {@link Attributes} containing the ALTS information
58+
* @return the created {@link AltsContext}
59+
* @throws IllegalArgumentException if the {@link Attributes} has no ALTS information.
60+
*/
61+
public static AltsContext createFrom(Attributes attributes) {
62+
Object authContext = attributes.get(AltsProtocolNegotiator.AUTH_CONTEXT_KEY);
4063
if (!(authContext instanceof AltsInternalContext)) {
4164
throw new IllegalArgumentException("No ALTS context information found");
4265
}
@@ -53,6 +76,16 @@ public static boolean check(ServerCall<?, ?> call) {
5376
return check(call.getAttributes());
5477
}
5578

79+
/**
80+
* Checks if the {@link ClientCall} contains ALTS information.
81+
*
82+
* @param call the {@link ClientCall} to check
83+
* @return true, if the {@link ClientCall} contains ALTS information and false otherwise.
84+
*/
85+
public static boolean check(ClientCall<?, ?> call) {
86+
return check(call.getAttributes());
87+
}
88+
5689
/**
5790
* Checks if the {@link Attributes} contains ALTS information.
5891
*

alts/src/test/java/io/grpc/alts/AltsContextUtilTest.java

+60-17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static org.mockito.Mockito.when;
2525

2626
import io.grpc.Attributes;
27+
import io.grpc.ClientCall;
2728
import io.grpc.ServerCall;
2829
import io.grpc.alts.AltsContext.SecurityLevel;
2930
import io.grpc.alts.internal.AltsInternalContext;
@@ -37,27 +38,38 @@
3738
/** Unit tests for {@link AltsContextUtil}. */
3839
@RunWith(JUnit4.class)
3940
public class AltsContextUtilTest {
40-
41-
private final ServerCall<?,?> call = mock(ServerCall.class);
42-
4341
@Test
4442
public void check_noAttributeValue() {
45-
when(call.getAttributes()).thenReturn(Attributes.newBuilder().build());
43+
assertFalse(AltsContextUtil.check(Attributes.newBuilder().build()));
44+
}
4645

47-
assertFalse(AltsContextUtil.check(call));
46+
@Test
47+
public void check_unexpectedAttributeValueType() {
48+
assertFalse(AltsContextUtil.check(Attributes.newBuilder()
49+
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, new Object())
50+
.build()));
4851
}
4952

5053
@Test
51-
public void contains_unexpectedAttributeValueType() {
54+
public void check_altsInternalContext() {
55+
assertTrue(AltsContextUtil.check(Attributes.newBuilder()
56+
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, AltsInternalContext.getDefaultInstance())
57+
.build()));
58+
}
59+
60+
@Test
61+
public void checkServer_altsInternalContext() {
62+
ServerCall<?,?> call = mock(ServerCall.class);
5263
when(call.getAttributes()).thenReturn(Attributes.newBuilder()
53-
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, new Object())
64+
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, AltsInternalContext.getDefaultInstance())
5465
.build());
5566

56-
assertFalse(AltsContextUtil.check(call));
67+
assertTrue(AltsContextUtil.check(call));
5768
}
5869

5970
@Test
60-
public void contains_altsInternalContext() {
71+
public void checkClient_altsInternalContext() {
72+
ClientCall<?,?> call = mock(ClientCall.class);
6173
when(call.getAttributes()).thenReturn(Attributes.newBuilder()
6274
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, AltsInternalContext.getDefaultInstance())
6375
.build());
@@ -66,26 +78,57 @@ public void contains_altsInternalContext() {
6678
}
6779

6880
@Test
69-
public void from_altsInternalContext() {
81+
public void createFrom_altsInternalContext() {
7082
HandshakerResult handshakerResult =
7183
HandshakerResult.newBuilder()
7284
.setPeerIdentity(Identity.newBuilder().setServiceAccount("remote@peer"))
7385
.setLocalIdentity(Identity.newBuilder().setServiceAccount("local@peer"))
7486
.build();
75-
when(call.getAttributes()).thenReturn(Attributes.newBuilder()
76-
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, new AltsInternalContext(handshakerResult))
77-
.build());
7887

79-
AltsContext context = AltsContextUtil.createFrom(call);
88+
AltsContext context = AltsContextUtil.createFrom(Attributes.newBuilder()
89+
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, new AltsInternalContext(handshakerResult))
90+
.build());
8091
assertEquals("remote@peer", context.getPeerServiceAccount());
8192
assertEquals("local@peer", context.getLocalServiceAccount());
8293
assertEquals(SecurityLevel.INTEGRITY_AND_PRIVACY, context.getSecurityLevel());
8394
}
8495

8596
@Test(expected = IllegalArgumentException.class)
86-
public void from_noAttributeValue() {
87-
when(call.getAttributes()).thenReturn(Attributes.newBuilder().build());
97+
public void createFrom_noAttributeValue() {
98+
AltsContextUtil.createFrom(Attributes.newBuilder().build());
99+
}
88100

89-
AltsContextUtil.createFrom(call);
101+
@Test
102+
public void createFromServer_altsInternalContext() {
103+
HandshakerResult handshakerResult =
104+
HandshakerResult.newBuilder()
105+
.setPeerIdentity(Identity.newBuilder().setServiceAccount("remote@peer"))
106+
.setLocalIdentity(Identity.newBuilder().setServiceAccount("local@peer"))
107+
.build();
108+
109+
ServerCall<?,?> call = mock(ServerCall.class);
110+
when(call.getAttributes()).thenReturn(Attributes.newBuilder()
111+
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, new AltsInternalContext(handshakerResult))
112+
.build());
113+
114+
AltsContext context = AltsContextUtil.createFrom(call);
115+
assertEquals("remote@peer", context.getPeerServiceAccount());
116+
}
117+
118+
@Test
119+
public void createFromClient_altsInternalContext() {
120+
HandshakerResult handshakerResult =
121+
HandshakerResult.newBuilder()
122+
.setPeerIdentity(Identity.newBuilder().setServiceAccount("remote@peer"))
123+
.setLocalIdentity(Identity.newBuilder().setServiceAccount("local@peer"))
124+
.build();
125+
126+
ClientCall<?,?> call = mock(ClientCall.class);
127+
when(call.getAttributes()).thenReturn(Attributes.newBuilder()
128+
.set(AltsProtocolNegotiator.AUTH_CONTEXT_KEY, new AltsInternalContext(handshakerResult))
129+
.build());
130+
131+
AltsContext context = AltsContextUtil.createFrom(call);
132+
assertEquals("remote@peer", context.getPeerServiceAccount());
90133
}
91134
}

0 commit comments

Comments
 (0)