grpc 1.26.0 → 1.27.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1654 -1519
  3. data/etc/roots.pem +44 -0
  4. data/include/grpc/grpc_security.h +37 -15
  5. data/include/grpc/grpc_security_constants.h +27 -0
  6. data/include/grpc/impl/codegen/grpc_types.h +14 -0
  7. data/include/grpc/impl/codegen/port_platform.h +1 -1
  8. data/src/core/ext/filters/client_channel/client_channel.cc +0 -20
  9. data/src/core/ext/filters/client_channel/http_proxy.cc +4 -4
  10. data/src/core/ext/filters/client_channel/lb_policy.cc +4 -3
  11. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +191 -201
  12. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
  13. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +3 -2
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +88 -121
  16. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +28 -57
  17. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +0 -7
  18. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +8 -9
  19. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +53 -34
  20. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +18 -5
  21. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +24 -19
  22. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -1
  23. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +4 -2
  24. data/src/core/ext/filters/client_channel/server_address.cc +6 -9
  25. data/src/core/ext/filters/client_channel/server_address.h +3 -10
  26. data/src/core/ext/filters/client_channel/xds/xds_api.cc +394 -150
  27. data/src/core/ext/filters/client_channel/xds/xds_api.h +75 -35
  28. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +59 -22
  29. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +13 -9
  30. data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +8 -6
  31. data/src/core/ext/filters/client_channel/xds/xds_client.cc +456 -175
  32. data/src/core/ext/filters/client_channel/xds/xds_client.h +33 -21
  33. data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +5 -8
  34. data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +18 -24
  35. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +2 -2
  36. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +13 -5
  37. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +34 -0
  38. data/src/core/lib/channel/channelz.h +11 -1
  39. data/src/core/lib/gpr/time_precise.cc +1 -1
  40. data/src/core/lib/gprpp/optional.h +26 -0
  41. data/src/core/lib/gprpp/string_view.h +14 -10
  42. data/src/core/lib/iomgr/executor.cc +1 -1
  43. data/src/core/lib/iomgr/fork_posix.cc +4 -0
  44. data/src/core/lib/iomgr/poller/eventmanager_libuv.cc +87 -0
  45. data/src/core/lib/iomgr/poller/eventmanager_libuv.h +88 -0
  46. data/src/core/lib/iomgr/socket_utils_common_posix.cc +14 -0
  47. data/src/core/lib/iomgr/socket_utils_posix.h +12 -0
  48. data/src/core/lib/iomgr/tcp_custom.h +3 -0
  49. data/src/core/lib/iomgr/tcp_posix.cc +607 -56
  50. data/src/core/lib/iomgr/tcp_server_custom.cc +15 -2
  51. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +8 -0
  52. data/src/core/lib/json/json.h +11 -1
  53. data/src/core/lib/json/json_reader.cc +206 -28
  54. data/src/core/lib/json/json_writer.cc +111 -24
  55. data/src/core/lib/security/credentials/composite/composite_credentials.cc +7 -0
  56. data/src/core/lib/security/credentials/composite/composite_credentials.h +5 -1
  57. data/src/core/lib/security/credentials/credentials.h +10 -1
  58. data/src/core/lib/security/credentials/fake/fake_credentials.h +2 -1
  59. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -1
  60. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -4
  61. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -1
  62. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +20 -0
  63. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +8 -0
  64. data/src/core/lib/security/credentials/tls/{spiffe_credentials.cc → tls_credentials.cc} +23 -24
  65. data/src/core/lib/security/credentials/tls/{spiffe_credentials.h → tls_credentials.h} +9 -9
  66. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +13 -0
  67. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +22 -2
  68. data/src/core/lib/security/security_connector/load_system_roots_fallback.cc +2 -2
  69. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +2 -2
  70. data/src/core/lib/security/security_connector/local/local_security_connector.cc +30 -3
  71. data/src/core/lib/security/security_connector/ssl_utils.cc +45 -3
  72. data/src/core/lib/security/security_connector/ssl_utils.h +12 -0
  73. data/src/core/lib/security/security_connector/tls/{spiffe_security_connector.cc → tls_security_connector.cc} +82 -69
  74. data/src/core/lib/security/security_connector/tls/{spiffe_security_connector.h → tls_security_connector.h} +17 -18
  75. data/src/core/lib/security/transport/client_auth_filter.cc +33 -0
  76. data/src/core/lib/surface/completion_queue.cc +22 -1
  77. data/src/core/lib/surface/version.cc +1 -1
  78. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +11 -1
  79. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
  80. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +3 -3
  81. data/src/core/tsi/fake_transport_security.cc +7 -3
  82. data/src/core/tsi/fake_transport_security.h +2 -0
  83. data/src/core/tsi/ssl_transport_security.cc +144 -8
  84. data/src/core/tsi/ssl_transport_security.h +15 -1
  85. data/src/core/tsi/transport_security.cc +13 -0
  86. data/src/core/tsi/transport_security_grpc.cc +2 -2
  87. data/src/core/tsi/transport_security_grpc.h +2 -2
  88. data/src/core/tsi/transport_security_interface.h +12 -0
  89. data/src/ruby/bin/math_pb.rb +5 -5
  90. data/src/ruby/ext/grpc/rb_call_credentials.c +4 -1
  91. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  92. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -1
  93. data/src/ruby/lib/grpc/version.rb +1 -1
  94. data/src/ruby/pb/grpc/health/v1/health_pb.rb +3 -3
  95. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +1 -1
  96. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +23 -13
  97. data/third_party/abseil-cpp/absl/algorithm/algorithm.h +159 -0
  98. data/third_party/abseil-cpp/absl/base/attributes.h +609 -0
  99. data/third_party/abseil-cpp/absl/base/call_once.h +226 -0
  100. data/third_party/abseil-cpp/absl/base/casts.h +184 -0
  101. data/third_party/abseil-cpp/absl/base/config.h +622 -0
  102. data/third_party/abseil-cpp/absl/base/const_init.h +76 -0
  103. data/third_party/abseil-cpp/absl/base/dynamic_annotations.cc +129 -0
  104. data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +389 -0
  105. data/third_party/abseil-cpp/absl/base/internal/atomic_hook.h +179 -0
  106. data/third_party/abseil-cpp/absl/base/internal/bits.h +218 -0
  107. data/third_party/abseil-cpp/absl/base/internal/cycleclock.cc +107 -0
  108. data/third_party/abseil-cpp/absl/base/internal/cycleclock.h +94 -0
  109. data/third_party/abseil-cpp/absl/base/internal/endian.h +266 -0
  110. data/third_party/abseil-cpp/absl/base/internal/hide_ptr.h +51 -0
  111. data/third_party/abseil-cpp/absl/base/internal/identity.h +37 -0
  112. data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +107 -0
  113. data/third_party/abseil-cpp/absl/base/internal/invoke.h +187 -0
  114. data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +107 -0
  115. data/third_party/abseil-cpp/absl/base/internal/per_thread_tls.h +52 -0
  116. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +237 -0
  117. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +179 -0
  118. data/third_party/abseil-cpp/absl/base/internal/scheduling_mode.h +58 -0
  119. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +233 -0
  120. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +243 -0
  121. data/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc +35 -0
  122. data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +67 -0
  123. data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +46 -0
  124. data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc +81 -0
  125. data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +93 -0
  126. data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +37 -0
  127. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +414 -0
  128. data/third_party/abseil-cpp/absl/base/internal/sysinfo.h +66 -0
  129. data/third_party/abseil-cpp/absl/base/internal/thread_annotations.h +271 -0
  130. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +140 -0
  131. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +250 -0
  132. data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +108 -0
  133. data/third_party/abseil-cpp/absl/base/internal/throw_delegate.h +75 -0
  134. data/third_party/abseil-cpp/absl/base/internal/tsan_mutex_interface.h +66 -0
  135. data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +158 -0
  136. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +103 -0
  137. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +124 -0
  138. data/third_party/abseil-cpp/absl/base/log_severity.cc +27 -0
  139. data/third_party/abseil-cpp/absl/base/log_severity.h +121 -0
  140. data/third_party/abseil-cpp/absl/base/macros.h +220 -0
  141. data/third_party/abseil-cpp/absl/base/optimization.h +181 -0
  142. data/third_party/abseil-cpp/absl/base/options.h +214 -0
  143. data/third_party/abseil-cpp/absl/base/policy_checks.h +111 -0
  144. data/third_party/abseil-cpp/absl/base/port.h +26 -0
  145. data/third_party/abseil-cpp/absl/base/thread_annotations.h +280 -0
  146. data/third_party/abseil-cpp/absl/container/inlined_vector.h +848 -0
  147. data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +265 -0
  148. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +892 -0
  149. data/third_party/abseil-cpp/absl/memory/memory.h +695 -0
  150. data/third_party/abseil-cpp/absl/meta/type_traits.h +759 -0
  151. data/third_party/abseil-cpp/absl/numeric/int128.cc +404 -0
  152. data/third_party/abseil-cpp/absl/numeric/int128.h +1091 -0
  153. data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +302 -0
  154. data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +308 -0
  155. data/third_party/abseil-cpp/absl/strings/ascii.cc +200 -0
  156. data/third_party/abseil-cpp/absl/strings/ascii.h +241 -0
  157. data/third_party/abseil-cpp/absl/strings/charconv.cc +985 -0
  158. data/third_party/abseil-cpp/absl/strings/charconv.h +119 -0
  159. data/third_party/abseil-cpp/absl/strings/escaping.cc +949 -0
  160. data/third_party/abseil-cpp/absl/strings/escaping.h +164 -0
  161. data/third_party/abseil-cpp/absl/strings/internal/char_map.h +156 -0
  162. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +359 -0
  163. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +421 -0
  164. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +504 -0
  165. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.h +99 -0
  166. data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +180 -0
  167. data/third_party/abseil-cpp/absl/strings/internal/escaping.h +58 -0
  168. data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +112 -0
  169. data/third_party/abseil-cpp/absl/strings/internal/memutil.h +148 -0
  170. data/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +36 -0
  171. data/third_party/abseil-cpp/absl/strings/internal/ostringstream.h +89 -0
  172. data/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h +73 -0
  173. data/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h +248 -0
  174. data/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h +314 -0
  175. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +455 -0
  176. data/third_party/abseil-cpp/absl/strings/internal/utf8.cc +53 -0
  177. data/third_party/abseil-cpp/absl/strings/internal/utf8.h +50 -0
  178. data/third_party/abseil-cpp/absl/strings/match.cc +40 -0
  179. data/third_party/abseil-cpp/absl/strings/match.h +90 -0
  180. data/third_party/abseil-cpp/absl/strings/numbers.cc +916 -0
  181. data/third_party/abseil-cpp/absl/strings/numbers.h +263 -0
  182. data/third_party/abseil-cpp/absl/strings/str_cat.cc +246 -0
  183. data/third_party/abseil-cpp/absl/strings/str_cat.h +408 -0
  184. data/third_party/abseil-cpp/absl/strings/str_join.h +293 -0
  185. data/third_party/abseil-cpp/absl/strings/str_replace.cc +82 -0
  186. data/third_party/abseil-cpp/absl/strings/str_replace.h +219 -0
  187. data/third_party/abseil-cpp/absl/strings/str_split.cc +139 -0
  188. data/third_party/abseil-cpp/absl/strings/str_split.h +513 -0
  189. data/third_party/abseil-cpp/absl/strings/string_view.cc +235 -0
  190. data/third_party/abseil-cpp/absl/strings/string_view.h +615 -0
  191. data/third_party/abseil-cpp/absl/strings/strip.h +91 -0
  192. data/third_party/abseil-cpp/absl/strings/substitute.cc +171 -0
  193. data/third_party/abseil-cpp/absl/strings/substitute.h +693 -0
  194. data/third_party/abseil-cpp/absl/types/bad_optional_access.cc +48 -0
  195. data/third_party/abseil-cpp/absl/types/bad_optional_access.h +78 -0
  196. data/third_party/abseil-cpp/absl/types/internal/optional.h +396 -0
  197. data/third_party/abseil-cpp/absl/types/internal/span.h +128 -0
  198. data/third_party/abseil-cpp/absl/types/optional.h +776 -0
  199. data/third_party/abseil-cpp/absl/types/span.h +713 -0
  200. data/third_party/abseil-cpp/absl/utility/utility.h +350 -0
  201. data/third_party/upb/upb/decode.c +4 -0
  202. data/third_party/upb/upb/port.c +0 -1
  203. data/third_party/upb/upb/port_def.inc +1 -3
  204. data/third_party/upb/upb/table.c +2 -1
  205. metadata +147 -43
  206. data/src/core/lib/json/json_common.h +0 -34
  207. data/src/core/lib/json/json_reader.h +0 -146
  208. data/src/core/lib/json/json_string.cc +0 -367
  209. data/src/core/lib/json/json_writer.h +0 -84
@@ -84,6 +84,30 @@ const char* grpc_get_ssl_cipher_suites(void) {
84
84
  return cipher_suites;
85
85
  }
86
86
 
87
+ grpc_security_level grpc_tsi_security_level_string_to_enum(
88
+ const char* security_level) {
89
+ if (strcmp(security_level, "TSI_INTEGRITY_ONLY") == 0) {
90
+ return GRPC_INTEGRITY_ONLY;
91
+ } else if (strcmp(security_level, "TSI_PRIVACY_AND_INTEGRITY") == 0) {
92
+ return GRPC_PRIVACY_AND_INTEGRITY;
93
+ }
94
+ return GRPC_SECURITY_NONE;
95
+ }
96
+
97
+ const char* grpc_security_level_to_string(grpc_security_level security_level) {
98
+ if (security_level == GRPC_PRIVACY_AND_INTEGRITY) {
99
+ return "GRPC_PRIVACY_AND_INTEGRITY";
100
+ } else if (security_level == GRPC_INTEGRITY_ONLY) {
101
+ return "GRPC_INTEGRITY_ONLY";
102
+ }
103
+ return "GRPC_SECURITY_NONE";
104
+ }
105
+
106
+ bool grpc_check_security_level(grpc_security_level channel_level,
107
+ grpc_security_level call_cred_level) {
108
+ return static_cast<int>(channel_level) >= static_cast<int>(call_cred_level);
109
+ }
110
+
87
111
  tsi_client_certificate_request_type
88
112
  grpc_get_tsi_client_certificate_request_type(
89
113
  grpc_ssl_client_certificate_request_type grpc_request_type) {
@@ -189,10 +213,9 @@ int grpc_ssl_cmp_target_name(
189
213
  grpc_core::StringView target_name, grpc_core::StringView other_target_name,
190
214
  grpc_core::StringView overridden_target_name,
191
215
  grpc_core::StringView other_overridden_target_name) {
192
- int c = grpc_core::StringViewCmp(target_name, other_target_name);
216
+ int c = target_name.compare(other_target_name);
193
217
  if (c != 0) return c;
194
- return grpc_core::StringViewCmp(overridden_target_name,
195
- other_overridden_target_name);
218
+ return overridden_target_name.compare(other_overridden_target_name);
196
219
  }
197
220
 
198
221
  grpc_core::RefCountedPtr<grpc_auth_context> grpc_ssl_peer_to_auth_context(
@@ -226,10 +249,18 @@ grpc_core::RefCountedPtr<grpc_auth_context> grpc_ssl_peer_to_auth_context(
226
249
  grpc_auth_context_add_property(ctx.get(),
227
250
  GRPC_X509_PEM_CERT_PROPERTY_NAME,
228
251
  prop->value.data, prop->value.length);
252
+ } else if (strcmp(prop->name, TSI_X509_PEM_CERT_CHAIN_PROPERTY) == 0) {
253
+ grpc_auth_context_add_property(ctx.get(),
254
+ GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME,
255
+ prop->value.data, prop->value.length);
229
256
  } else if (strcmp(prop->name, TSI_SSL_SESSION_REUSED_PEER_PROPERTY) == 0) {
230
257
  grpc_auth_context_add_property(ctx.get(),
231
258
  GRPC_SSL_SESSION_REUSED_PROPERTY,
232
259
  prop->value.data, prop->value.length);
260
+ } else if (strcmp(prop->name, TSI_SECURITY_LEVEL_PEER_PROPERTY) == 0) {
261
+ grpc_auth_context_add_property(
262
+ ctx.get(), GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME,
263
+ prop->value.data, prop->value.length);
233
264
  }
234
265
  }
235
266
  if (peer_identity_property_name != nullptr) {
@@ -273,6 +304,14 @@ tsi_peer grpc_shallow_peer_from_ssl_auth_context(
273
304
  } else if (strcmp(prop->name, GRPC_X509_PEM_CERT_PROPERTY_NAME) == 0) {
274
305
  add_shallow_auth_property_to_peer(&peer, prop,
275
306
  TSI_X509_PEM_CERT_PROPERTY);
307
+ } else if (strcmp(prop->name,
308
+ GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME) == 0) {
309
+ add_shallow_auth_property_to_peer(&peer, prop,
310
+ TSI_SECURITY_LEVEL_PEER_PROPERTY);
311
+ } else if (strcmp(prop->name, GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME) ==
312
+ 0) {
313
+ add_shallow_auth_property_to_peer(&peer, prop,
314
+ TSI_X509_PEM_CERT_CHAIN_PROPERTY);
276
315
  }
277
316
  }
278
317
  }
@@ -285,6 +324,7 @@ void grpc_shallow_peer_destruct(tsi_peer* peer) {
285
324
 
286
325
  grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
287
326
  tsi_ssl_pem_key_cert_pair* pem_key_cert_pair, const char* pem_root_certs,
327
+ bool skip_server_certificate_verification,
288
328
  tsi_ssl_session_cache* ssl_session_cache,
289
329
  tsi_ssl_client_handshaker_factory** handshaker_factory) {
290
330
  const char* root_certs;
@@ -315,6 +355,8 @@ grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
315
355
  }
316
356
  options.cipher_suites = grpc_get_ssl_cipher_suites();
317
357
  options.session_cache = ssl_session_cache;
358
+ options.skip_server_certificate_verification =
359
+ skip_server_certificate_verification;
318
360
  const tsi_result result =
319
361
  tsi_create_ssl_client_handshaker_factory_with_options(&options,
320
362
  handshaker_factory);
@@ -68,12 +68,24 @@ tsi_client_certificate_request_type
68
68
  grpc_get_tsi_client_certificate_request_type(
69
69
  grpc_ssl_client_certificate_request_type grpc_request_type);
70
70
 
71
+ /* Map tsi_security_level string to grpc_security_level enum. */
72
+ grpc_security_level grpc_tsi_security_level_string_to_enum(
73
+ const char* security_level);
74
+
75
+ /* Map grpc_security_level enum to a string. */
76
+ const char* grpc_security_level_to_string(grpc_security_level security_level);
77
+
78
+ /* Check security level of channel and call credential.*/
79
+ bool grpc_check_security_level(grpc_security_level channel_level,
80
+ grpc_security_level call_cred_level);
81
+
71
82
  /* Return an array of strings containing alpn protocols. */
72
83
  const char** grpc_fill_alpn_protocol_strings(size_t* num_alpn_protocols);
73
84
 
74
85
  /* Initialize TSI SSL server/client handshaker factory. */
75
86
  grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
76
87
  tsi_ssl_pem_key_cert_pair* key_cert_pair, const char* pem_root_certs,
88
+ bool skip_server_certificate_verification,
77
89
  tsi_ssl_session_cache* ssl_session_cache,
78
90
  tsi_ssl_client_handshaker_factory** handshaker_factory);
79
91
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  #include <grpc/support/port_platform.h>
20
20
 
21
- #include "src/core/lib/security/security_connector/tls/spiffe_security_connector.h"
21
+ #include "src/core/lib/security/security_connector/tls/tls_security_connector.h"
22
22
 
23
23
  #include <stdbool.h>
24
24
  #include <string.h>
@@ -30,7 +30,7 @@
30
30
 
31
31
  #include "src/core/lib/gprpp/host_port.h"
32
32
  #include "src/core/lib/security/credentials/ssl/ssl_credentials.h"
33
- #include "src/core/lib/security/credentials/tls/spiffe_credentials.h"
33
+ #include "src/core/lib/security/credentials/tls/tls_credentials.h"
34
34
  #include "src/core/lib/security/security_connector/ssl_utils.h"
35
35
  #include "src/core/lib/security/transport/security_handshaker.h"
36
36
  #include "src/core/lib/slice/slice_internal.h"
@@ -62,16 +62,17 @@ tsi_ssl_pem_key_cert_pair* ConvertToTsiPemKeyCertPair(
62
62
 
63
63
  } // namespace
64
64
 
65
- /** -- Util function to fetch SPIFFE server/channel credentials. -- */
65
+ /** -- Util function to fetch TLS server/channel credentials. -- */
66
66
  grpc_status_code TlsFetchKeyMaterials(
67
67
  const grpc_core::RefCountedPtr<grpc_tls_key_materials_config>&
68
68
  key_materials_config,
69
- const grpc_tls_credentials_options& options,
69
+ const grpc_tls_credentials_options& options, bool server_config,
70
70
  grpc_ssl_certificate_config_reload_status* reload_status) {
71
71
  GPR_ASSERT(key_materials_config != nullptr);
72
72
  bool is_key_materials_empty =
73
73
  key_materials_config->pem_key_cert_pair_list().empty();
74
- if (options.credential_reload_config() == nullptr && is_key_materials_empty) {
74
+ if (options.credential_reload_config() == nullptr && is_key_materials_empty &&
75
+ server_config) {
75
76
  gpr_log(GPR_ERROR,
76
77
  "Either credential reload config or key materials should be "
77
78
  "provisioned.");
@@ -111,7 +112,7 @@ grpc_status_code TlsFetchKeyMaterials(
111
112
  return status;
112
113
  }
113
114
 
114
- SpiffeChannelSecurityConnector::SpiffeChannelSecurityConnector(
115
+ TlsChannelSecurityConnector::TlsChannelSecurityConnector(
115
116
  grpc_core::RefCountedPtr<grpc_channel_credentials> channel_creds,
116
117
  grpc_core::RefCountedPtr<grpc_call_credentials> request_metadata_creds,
117
118
  const char* target_name, const char* overridden_target_name)
@@ -129,7 +130,7 @@ SpiffeChannelSecurityConnector::SpiffeChannelSecurityConnector(
129
130
  target_name_ = grpc_core::StringViewToCString(host);
130
131
  }
131
132
 
132
- SpiffeChannelSecurityConnector::~SpiffeChannelSecurityConnector() {
133
+ TlsChannelSecurityConnector::~TlsChannelSecurityConnector() {
133
134
  if (client_handshaker_factory_ != nullptr) {
134
135
  tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
135
136
  }
@@ -139,7 +140,7 @@ SpiffeChannelSecurityConnector::~SpiffeChannelSecurityConnector() {
139
140
  ServerAuthorizationCheckArgDestroy(check_arg_);
140
141
  }
141
142
 
142
- void SpiffeChannelSecurityConnector::add_handshakers(
143
+ void TlsChannelSecurityConnector::add_handshakers(
143
144
  const grpc_channel_args* args, grpc_pollset_set* /*interested_parties*/,
144
145
  grpc_core::HandshakeManager* handshake_mgr) {
145
146
  if (RefreshHandshakerFactory() != GRPC_SECURITY_OK) {
@@ -162,7 +163,7 @@ void SpiffeChannelSecurityConnector::add_handshakers(
162
163
  handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this, args));
163
164
  }
164
165
 
165
- void SpiffeChannelSecurityConnector::check_peer(
166
+ void TlsChannelSecurityConnector::check_peer(
166
167
  tsi_peer peer, grpc_endpoint* /*ep*/,
167
168
  grpc_core::RefCountedPtr<grpc_auth_context>* auth_context,
168
169
  grpc_closure* on_peer_checked) {
@@ -175,10 +176,10 @@ void SpiffeChannelSecurityConnector::check_peer(
175
176
  tsi_peer_destruct(&peer);
176
177
  return;
177
178
  }
178
- *auth_context = grpc_ssl_peer_to_auth_context(
179
- &peer, GRPC_TLS_SPIFFE_TRANSPORT_SECURITY_TYPE);
180
- const SpiffeCredentials* creds =
181
- static_cast<const SpiffeCredentials*>(channel_creds());
179
+ *auth_context =
180
+ grpc_ssl_peer_to_auth_context(&peer, GRPC_TLS_TRANSPORT_SECURITY_TYPE);
181
+ const TlsCredentials* creds =
182
+ static_cast<const TlsCredentials*>(channel_creds());
182
183
  const grpc_tls_server_authorization_check_config* config =
183
184
  creds->options().server_authorization_check_config();
184
185
  /* If server authorization config is not null, use it to perform
@@ -190,9 +191,8 @@ void SpiffeChannelSecurityConnector::check_peer(
190
191
  error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
191
192
  "Cannot check peer: missing pem cert property.");
192
193
  } else {
193
- char* peer_pem = static_cast<char*>(gpr_malloc(p->value.length + 1));
194
+ char* peer_pem = static_cast<char*>(gpr_zalloc(p->value.length + 1));
194
195
  memcpy(peer_pem, p->value.data, p->value.length);
195
- peer_pem[p->value.length] = '\0';
196
196
  GPR_ASSERT(check_arg_ != nullptr);
197
197
  check_arg_->peer_cert = check_arg_->peer_cert == nullptr
198
198
  ? gpr_strdup(peer_pem)
@@ -202,6 +202,18 @@ void SpiffeChannelSecurityConnector::check_peer(
202
202
  : check_arg_->target_name;
203
203
  on_peer_checked_ = on_peer_checked;
204
204
  gpr_free(peer_pem);
205
+ const tsi_peer_property* chain = tsi_peer_get_property_by_name(
206
+ &peer, TSI_X509_PEM_CERT_CHAIN_PROPERTY);
207
+ if (chain != nullptr) {
208
+ char* peer_pem_chain =
209
+ static_cast<char*>(gpr_zalloc(chain->value.length + 1));
210
+ memcpy(peer_pem_chain, chain->value.data, chain->value.length);
211
+ check_arg_->peer_cert_full_chain =
212
+ check_arg_->peer_cert_full_chain == nullptr
213
+ ? gpr_strdup(peer_pem_chain)
214
+ : check_arg_->peer_cert_full_chain;
215
+ gpr_free(peer_pem_chain);
216
+ }
205
217
  int callback_status = config->Schedule(check_arg_);
206
218
  /* Server authorization check is handled asynchronously. */
207
219
  if (callback_status) {
@@ -216,10 +228,9 @@ void SpiffeChannelSecurityConnector::check_peer(
216
228
  tsi_peer_destruct(&peer);
217
229
  }
218
230
 
219
- int SpiffeChannelSecurityConnector::cmp(
231
+ int TlsChannelSecurityConnector::cmp(
220
232
  const grpc_security_connector* other_sc) const {
221
- auto* other =
222
- reinterpret_cast<const SpiffeChannelSecurityConnector*>(other_sc);
233
+ auto* other = reinterpret_cast<const TlsChannelSecurityConnector*>(other_sc);
223
234
  int c = channel_security_connector_cmp(other);
224
235
  if (c != 0) {
225
236
  return c;
@@ -229,7 +240,7 @@ int SpiffeChannelSecurityConnector::cmp(
229
240
  other->overridden_target_name_.get());
230
241
  }
231
242
 
232
- bool SpiffeChannelSecurityConnector::check_call_host(
243
+ bool TlsChannelSecurityConnector::check_call_host(
233
244
  grpc_core::StringView host, grpc_auth_context* auth_context,
234
245
  grpc_closure* on_call_host_checked, grpc_error** error) {
235
246
  return grpc_ssl_check_call_host(host, target_name_.get(),
@@ -237,13 +248,13 @@ bool SpiffeChannelSecurityConnector::check_call_host(
237
248
  on_call_host_checked, error);
238
249
  }
239
250
 
240
- void SpiffeChannelSecurityConnector::cancel_check_call_host(
251
+ void TlsChannelSecurityConnector::cancel_check_call_host(
241
252
  grpc_closure* /*on_call_host_checked*/, grpc_error* error) {
242
253
  GRPC_ERROR_UNREF(error);
243
254
  }
244
255
 
245
256
  grpc_core::RefCountedPtr<grpc_channel_security_connector>
246
- SpiffeChannelSecurityConnector::CreateSpiffeChannelSecurityConnector(
257
+ TlsChannelSecurityConnector::CreateTlsChannelSecurityConnector(
247
258
  grpc_core::RefCountedPtr<grpc_channel_credentials> channel_creds,
248
259
  grpc_core::RefCountedPtr<grpc_call_credentials> request_metadata_creds,
249
260
  const char* target_name, const char* overridden_target_name,
@@ -251,17 +262,17 @@ SpiffeChannelSecurityConnector::CreateSpiffeChannelSecurityConnector(
251
262
  if (channel_creds == nullptr) {
252
263
  gpr_log(GPR_ERROR,
253
264
  "channel_creds is nullptr in "
254
- "SpiffeChannelSecurityConnectorCreate()");
265
+ "TlsChannelSecurityConnectorCreate()");
255
266
  return nullptr;
256
267
  }
257
268
  if (target_name == nullptr) {
258
269
  gpr_log(GPR_ERROR,
259
270
  "target_name is nullptr in "
260
- "SpiffeChannelSecurityConnectorCreate()");
271
+ "TlsChannelSecurityConnectorCreate()");
261
272
  return nullptr;
262
273
  }
263
- grpc_core::RefCountedPtr<SpiffeChannelSecurityConnector> c =
264
- grpc_core::MakeRefCounted<SpiffeChannelSecurityConnector>(
274
+ grpc_core::RefCountedPtr<TlsChannelSecurityConnector> c =
275
+ grpc_core::MakeRefCounted<TlsChannelSecurityConnector>(
265
276
  std::move(channel_creds), std::move(request_metadata_creds),
266
277
  target_name, overridden_target_name);
267
278
  if (c->InitializeHandshakerFactory(ssl_session_cache) != GRPC_SECURITY_OK) {
@@ -271,29 +282,33 @@ SpiffeChannelSecurityConnector::CreateSpiffeChannelSecurityConnector(
271
282
  return c;
272
283
  }
273
284
 
274
- grpc_security_status SpiffeChannelSecurityConnector::ReplaceHandshakerFactory(
285
+ grpc_security_status TlsChannelSecurityConnector::ReplaceHandshakerFactory(
275
286
  tsi_ssl_session_cache* ssl_session_cache) {
287
+ const TlsCredentials* creds =
288
+ static_cast<const TlsCredentials*>(channel_creds());
289
+ bool skip_server_certificate_verification =
290
+ creds->options().server_verification_option() ==
291
+ GRPC_TLS_SKIP_ALL_SERVER_VERIFICATION;
276
292
  /* Free the client handshaker factory if exists. */
277
293
  if (client_handshaker_factory_) {
278
294
  tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
279
295
  }
280
- GPR_ASSERT(!key_materials_config_->pem_key_cert_pair_list().empty());
281
296
  tsi_ssl_pem_key_cert_pair* pem_key_cert_pair = ConvertToTsiPemKeyCertPair(
282
297
  key_materials_config_->pem_key_cert_pair_list());
283
298
  grpc_security_status status = grpc_ssl_tsi_client_handshaker_factory_init(
284
299
  pem_key_cert_pair, key_materials_config_->pem_root_certs(),
285
- ssl_session_cache, &client_handshaker_factory_);
300
+ skip_server_certificate_verification, ssl_session_cache,
301
+ &client_handshaker_factory_);
286
302
  /* Free memory. */
287
303
  grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pair, 1);
288
304
  return status;
289
305
  }
290
306
 
291
- grpc_security_status
292
- SpiffeChannelSecurityConnector::InitializeHandshakerFactory(
307
+ grpc_security_status TlsChannelSecurityConnector::InitializeHandshakerFactory(
293
308
  tsi_ssl_session_cache* ssl_session_cache) {
294
309
  grpc_core::MutexLock lock(&mu_);
295
- const SpiffeCredentials* creds =
296
- static_cast<const SpiffeCredentials*>(channel_creds());
310
+ const TlsCredentials* creds =
311
+ static_cast<const TlsCredentials*>(channel_creds());
297
312
  grpc_tls_key_materials_config* key_materials_config =
298
313
  creds->options().key_materials_config();
299
314
  /* Copy key materials config from credential options. */
@@ -307,7 +322,7 @@ SpiffeChannelSecurityConnector::InitializeHandshakerFactory(
307
322
  }
308
323
  grpc_ssl_certificate_config_reload_status reload_status =
309
324
  GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
310
- if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
325
+ if (TlsFetchKeyMaterials(key_materials_config_, creds->options(), false,
311
326
  &reload_status) != GRPC_STATUS_OK) {
312
327
  /* Raise an error if key materials are not populated. */
313
328
  return GRPC_SECURITY_ERROR;
@@ -315,14 +330,13 @@ SpiffeChannelSecurityConnector::InitializeHandshakerFactory(
315
330
  return ReplaceHandshakerFactory(ssl_session_cache);
316
331
  }
317
332
 
318
- grpc_security_status
319
- SpiffeChannelSecurityConnector::RefreshHandshakerFactory() {
333
+ grpc_security_status TlsChannelSecurityConnector::RefreshHandshakerFactory() {
320
334
  grpc_core::MutexLock lock(&mu_);
321
- const SpiffeCredentials* creds =
322
- static_cast<const SpiffeCredentials*>(channel_creds());
335
+ const TlsCredentials* creds =
336
+ static_cast<const TlsCredentials*>(channel_creds());
323
337
  grpc_ssl_certificate_config_reload_status reload_status =
324
338
  GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
325
- if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
339
+ if (TlsFetchKeyMaterials(key_materials_config_, creds->options(), false,
326
340
  &reload_status) != GRPC_STATUS_OK) {
327
341
  return GRPC_SECURITY_ERROR;
328
342
  }
@@ -334,18 +348,17 @@ SpiffeChannelSecurityConnector::RefreshHandshakerFactory() {
334
348
  }
335
349
  }
336
350
 
337
- void SpiffeChannelSecurityConnector::ServerAuthorizationCheckDone(
351
+ void TlsChannelSecurityConnector::ServerAuthorizationCheckDone(
338
352
  grpc_tls_server_authorization_check_arg* arg) {
339
353
  GPR_ASSERT(arg != nullptr);
340
354
  grpc_core::ExecCtx exec_ctx;
341
355
  grpc_error* error = ProcessServerAuthorizationCheckResult(arg);
342
- SpiffeChannelSecurityConnector* connector =
343
- static_cast<SpiffeChannelSecurityConnector*>(arg->cb_user_data);
356
+ TlsChannelSecurityConnector* connector =
357
+ static_cast<TlsChannelSecurityConnector*>(arg->cb_user_data);
344
358
  grpc_core::ExecCtx::Run(DEBUG_LOCATION, connector->on_peer_checked_, error);
345
359
  }
346
360
 
347
- grpc_error*
348
- SpiffeChannelSecurityConnector::ProcessServerAuthorizationCheckResult(
361
+ grpc_error* TlsChannelSecurityConnector::ProcessServerAuthorizationCheckResult(
349
362
  grpc_tls_server_authorization_check_arg* arg) {
350
363
  grpc_error* error = GRPC_ERROR_NONE;
351
364
  char* msg = nullptr;
@@ -377,7 +390,7 @@ SpiffeChannelSecurityConnector::ProcessServerAuthorizationCheckResult(
377
390
  }
378
391
 
379
392
  grpc_tls_server_authorization_check_arg*
380
- SpiffeChannelSecurityConnector::ServerAuthorizationCheckArgCreate(
393
+ TlsChannelSecurityConnector::ServerAuthorizationCheckArgCreate(
381
394
  void* user_data) {
382
395
  grpc_tls_server_authorization_check_arg* arg =
383
396
  new grpc_tls_server_authorization_check_arg();
@@ -387,13 +400,14 @@ SpiffeChannelSecurityConnector::ServerAuthorizationCheckArgCreate(
387
400
  return arg;
388
401
  }
389
402
 
390
- void SpiffeChannelSecurityConnector::ServerAuthorizationCheckArgDestroy(
403
+ void TlsChannelSecurityConnector::ServerAuthorizationCheckArgDestroy(
391
404
  grpc_tls_server_authorization_check_arg* arg) {
392
405
  if (arg == nullptr) {
393
406
  return;
394
407
  }
395
408
  gpr_free((void*)arg->target_name);
396
409
  gpr_free((void*)arg->peer_cert);
410
+ if (arg->peer_cert_full_chain) gpr_free((void*)arg->peer_cert_full_chain);
397
411
  gpr_free((void*)arg->error_details);
398
412
  if (arg->destroy_context != nullptr) {
399
413
  arg->destroy_context(arg->context);
@@ -401,14 +415,14 @@ void SpiffeChannelSecurityConnector::ServerAuthorizationCheckArgDestroy(
401
415
  delete arg;
402
416
  }
403
417
 
404
- SpiffeServerSecurityConnector::SpiffeServerSecurityConnector(
418
+ TlsServerSecurityConnector::TlsServerSecurityConnector(
405
419
  grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
406
420
  : grpc_server_security_connector(GRPC_SSL_URL_SCHEME,
407
421
  std::move(server_creds)) {
408
422
  key_materials_config_ = grpc_tls_key_materials_config_create()->Ref();
409
423
  }
410
424
 
411
- SpiffeServerSecurityConnector::~SpiffeServerSecurityConnector() {
425
+ TlsServerSecurityConnector::~TlsServerSecurityConnector() {
412
426
  if (server_handshaker_factory_ != nullptr) {
413
427
  tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
414
428
  }
@@ -417,7 +431,7 @@ SpiffeServerSecurityConnector::~SpiffeServerSecurityConnector() {
417
431
  }
418
432
  }
419
433
 
420
- void SpiffeServerSecurityConnector::add_handshakers(
434
+ void TlsServerSecurityConnector::add_handshakers(
421
435
  const grpc_channel_args* args, grpc_pollset_set* /*interested_parties*/,
422
436
  grpc_core::HandshakeManager* handshake_mgr) {
423
437
  /* Refresh handshaker factory if needed. */
@@ -425,7 +439,7 @@ void SpiffeServerSecurityConnector::add_handshakers(
425
439
  gpr_log(GPR_ERROR, "Handshaker factory refresh failed.");
426
440
  return;
427
441
  }
428
- /* Create a TLS SPIFFE TSI handshaker for server. */
442
+ /* Create a TLS TSI handshaker for server. */
429
443
  tsi_handshaker* tsi_hs = nullptr;
430
444
  tsi_result result = tsi_ssl_server_handshaker_factory_create_handshaker(
431
445
  server_handshaker_factory_, &tsi_hs);
@@ -437,34 +451,34 @@ void SpiffeServerSecurityConnector::add_handshakers(
437
451
  handshake_mgr->Add(grpc_core::SecurityHandshakerCreate(tsi_hs, this, args));
438
452
  }
439
453
 
440
- void SpiffeServerSecurityConnector::check_peer(
454
+ void TlsServerSecurityConnector::check_peer(
441
455
  tsi_peer peer, grpc_endpoint* /*ep*/,
442
456
  grpc_core::RefCountedPtr<grpc_auth_context>* auth_context,
443
457
  grpc_closure* on_peer_checked) {
444
458
  grpc_error* error = grpc_ssl_check_alpn(&peer);
445
- *auth_context = grpc_ssl_peer_to_auth_context(
446
- &peer, GRPC_TLS_SPIFFE_TRANSPORT_SECURITY_TYPE);
459
+ *auth_context =
460
+ grpc_ssl_peer_to_auth_context(&peer, GRPC_TLS_TRANSPORT_SECURITY_TYPE);
447
461
  tsi_peer_destruct(&peer);
448
462
  grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_peer_checked, error);
449
463
  }
450
464
 
451
- int SpiffeServerSecurityConnector::cmp(
465
+ int TlsServerSecurityConnector::cmp(
452
466
  const grpc_security_connector* other) const {
453
467
  return server_security_connector_cmp(
454
468
  static_cast<const grpc_server_security_connector*>(other));
455
469
  }
456
470
 
457
471
  grpc_core::RefCountedPtr<grpc_server_security_connector>
458
- SpiffeServerSecurityConnector::CreateSpiffeServerSecurityConnector(
472
+ TlsServerSecurityConnector::CreateTlsServerSecurityConnector(
459
473
  grpc_core::RefCountedPtr<grpc_server_credentials> server_creds) {
460
474
  if (server_creds == nullptr) {
461
475
  gpr_log(GPR_ERROR,
462
476
  "server_creds is nullptr in "
463
- "SpiffeServerSecurityConnectorCreate()");
477
+ "TlsServerSecurityConnectorCreate()");
464
478
  return nullptr;
465
479
  }
466
- grpc_core::RefCountedPtr<SpiffeServerSecurityConnector> c =
467
- grpc_core::MakeRefCounted<SpiffeServerSecurityConnector>(
480
+ grpc_core::RefCountedPtr<TlsServerSecurityConnector> c =
481
+ grpc_core::MakeRefCounted<TlsServerSecurityConnector>(
468
482
  std::move(server_creds));
469
483
  if (c->InitializeHandshakerFactory() != GRPC_SECURITY_OK) {
470
484
  gpr_log(GPR_ERROR, "Could not initialize server handshaker factory.");
@@ -473,9 +487,9 @@ SpiffeServerSecurityConnector::CreateSpiffeServerSecurityConnector(
473
487
  return c;
474
488
  }
475
489
 
476
- grpc_security_status SpiffeServerSecurityConnector::ReplaceHandshakerFactory() {
477
- const SpiffeServerCredentials* creds =
478
- static_cast<const SpiffeServerCredentials*>(server_creds());
490
+ grpc_security_status TlsServerSecurityConnector::ReplaceHandshakerFactory() {
491
+ const TlsServerCredentials* creds =
492
+ static_cast<const TlsServerCredentials*>(server_creds());
479
493
  /* Free the server handshaker factory if exists. */
480
494
  if (server_handshaker_factory_) {
481
495
  tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
@@ -495,11 +509,10 @@ grpc_security_status SpiffeServerSecurityConnector::ReplaceHandshakerFactory() {
495
509
  return status;
496
510
  }
497
511
 
498
- grpc_security_status
499
- SpiffeServerSecurityConnector::InitializeHandshakerFactory() {
512
+ grpc_security_status TlsServerSecurityConnector::InitializeHandshakerFactory() {
500
513
  grpc_core::MutexLock lock(&mu_);
501
- const SpiffeServerCredentials* creds =
502
- static_cast<const SpiffeServerCredentials*>(server_creds());
514
+ const TlsServerCredentials* creds =
515
+ static_cast<const TlsServerCredentials*>(server_creds());
503
516
  grpc_tls_key_materials_config* key_materials_config =
504
517
  creds->options().key_materials_config();
505
518
  if (key_materials_config != nullptr) {
@@ -512,7 +525,7 @@ SpiffeServerSecurityConnector::InitializeHandshakerFactory() {
512
525
  }
513
526
  grpc_ssl_certificate_config_reload_status reload_status =
514
527
  GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
515
- if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
528
+ if (TlsFetchKeyMaterials(key_materials_config_, creds->options(), true,
516
529
  &reload_status) != GRPC_STATUS_OK) {
517
530
  /* Raise an error if key materials are not populated. */
518
531
  return GRPC_SECURITY_ERROR;
@@ -520,13 +533,13 @@ SpiffeServerSecurityConnector::InitializeHandshakerFactory() {
520
533
  return ReplaceHandshakerFactory();
521
534
  }
522
535
 
523
- grpc_security_status SpiffeServerSecurityConnector::RefreshHandshakerFactory() {
536
+ grpc_security_status TlsServerSecurityConnector::RefreshHandshakerFactory() {
524
537
  grpc_core::MutexLock lock(&mu_);
525
- const SpiffeServerCredentials* creds =
526
- static_cast<const SpiffeServerCredentials*>(server_creds());
538
+ const TlsServerCredentials* creds =
539
+ static_cast<const TlsServerCredentials*>(server_creds());
527
540
  grpc_ssl_certificate_config_reload_status reload_status =
528
541
  GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED;
529
- if (TlsFetchKeyMaterials(key_materials_config_, creds->options(),
542
+ if (TlsFetchKeyMaterials(key_materials_config_, creds->options(), true,
530
543
  &reload_status) != GRPC_STATUS_OK) {
531
544
  return GRPC_SECURITY_ERROR;
532
545
  }