grpc 1.55.0 → 1.56.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +102 -68
  3. data/include/grpc/event_engine/event_engine.h +4 -3
  4. data/include/grpc/grpc_audit_logging.h +96 -0
  5. data/include/grpc/grpc_security.h +19 -0
  6. data/include/grpc/module.modulemap +2 -0
  7. data/include/grpc/support/json.h +218 -0
  8. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +5 -0
  9. data/src/core/ext/filters/client_channel/backend_metric.cc +2 -0
  10. data/src/core/ext/filters/client_channel/channel_connectivity.cc +4 -4
  11. data/src/core/ext/filters/client_channel/client_channel.cc +86 -104
  12. data/src/core/ext/filters/client_channel/client_channel.h +6 -0
  13. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +19 -18
  14. data/src/core/ext/filters/client_channel/client_channel_internal.h +16 -21
  15. data/src/core/ext/filters/client_channel/config_selector.h +9 -24
  16. data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -0
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +5 -4
  18. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +455 -0
  19. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +54 -0
  20. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +186 -0
  21. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +2 -7
  22. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +53 -21
  23. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +23 -2
  24. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +19 -6
  25. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +1 -9
  26. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +16 -7
  27. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +18 -1
  28. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +12 -9
  29. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +6 -4
  30. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +36 -13
  31. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +76 -6
  32. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +42 -40
  33. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +4 -10
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +52 -47
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +1 -9
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +14 -16
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +40 -43
  38. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +7 -12
  39. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -19
  40. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +35 -33
  41. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +29 -4
  42. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/service_config_helper.cc +1 -1
  43. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +28 -27
  44. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +163 -46
  45. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +16 -1
  46. data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -0
  47. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +10 -40
  48. data/src/core/ext/filters/client_channel/subchannel.cc +10 -196
  49. data/src/core/ext/filters/client_channel/subchannel.h +3 -43
  50. data/src/core/ext/filters/http/message_compress/compression_filter.cc +5 -5
  51. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +100 -6
  52. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +6 -8
  53. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +3 -3
  54. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +16 -1
  55. data/src/core/ext/transport/chttp2/transport/flow_control.cc +46 -95
  56. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +176 -0
  57. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +325 -0
  58. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +567 -543
  59. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +150 -9
  60. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +46 -32
  61. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +18 -5
  62. data/src/core/ext/transport/chttp2/transport/internal.h +1 -15
  63. data/src/core/ext/transport/chttp2/transport/parsing.cc +12 -12
  64. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +11 -2
  65. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +15 -0
  66. data/src/core/ext/xds/certificate_provider_store.cc +4 -9
  67. data/src/core/ext/xds/certificate_provider_store.h +1 -1
  68. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +30 -42
  69. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +14 -9
  70. data/src/core/ext/xds/xds_api.cc +9 -6
  71. data/src/core/ext/xds/xds_api.h +3 -2
  72. data/src/core/ext/xds/xds_audit_logger_registry.cc +122 -0
  73. data/src/core/ext/xds/xds_audit_logger_registry.h +68 -0
  74. data/src/core/ext/xds/xds_bootstrap_grpc.cc +21 -9
  75. data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -0
  76. data/src/core/ext/xds/xds_client.cc +5 -4
  77. data/src/core/ext/xds/xds_client_stats.h +1 -1
  78. data/src/core/ext/xds/xds_cluster.cc +20 -19
  79. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +11 -8
  80. data/src/core/ext/xds/xds_common_types.cc +3 -1
  81. data/src/core/ext/xds/xds_http_fault_filter.cc +16 -13
  82. data/src/core/ext/xds/xds_http_fault_filter.h +2 -1
  83. data/src/core/ext/xds/xds_http_filters.h +4 -2
  84. data/src/core/ext/xds/xds_http_rbac_filter.cc +154 -67
  85. data/src/core/ext/xds/xds_http_rbac_filter.h +2 -1
  86. data/src/core/ext/xds/xds_http_stateful_session_filter.cc +15 -11
  87. data/src/core/ext/xds/xds_http_stateful_session_filter.h +2 -1
  88. data/src/core/ext/xds/xds_lb_policy_registry.cc +22 -16
  89. data/src/core/ext/xds/xds_listener.cc +1 -0
  90. data/src/core/ext/xds/xds_route_config.cc +40 -3
  91. data/src/core/ext/xds/xds_routing.cc +2 -2
  92. data/src/core/ext/xds/xds_transport_grpc.cc +3 -1
  93. data/src/core/lib/avl/avl.h +5 -0
  94. data/src/core/lib/backoff/random_early_detection.h +5 -0
  95. data/src/core/lib/channel/channel_args.cc +80 -22
  96. data/src/core/lib/channel/channel_args.h +34 -1
  97. data/src/core/lib/channel/channel_trace.cc +16 -12
  98. data/src/core/lib/channel/channelz.cc +159 -132
  99. data/src/core/lib/channel/channelz.h +42 -35
  100. data/src/core/lib/channel/channelz_registry.cc +23 -20
  101. data/src/core/lib/channel/connected_channel.cc +17 -6
  102. data/src/core/lib/channel/promise_based_filter.cc +0 -4
  103. data/src/core/lib/channel/promise_based_filter.h +2 -0
  104. data/src/core/lib/compression/compression_internal.cc +2 -5
  105. data/src/core/lib/config/config_vars.cc +20 -18
  106. data/src/core/lib/config/config_vars.h +4 -4
  107. data/src/core/lib/config/load_config.cc +13 -0
  108. data/src/core/lib/config/load_config.h +6 -0
  109. data/src/core/lib/debug/event_log.h +1 -1
  110. data/src/core/lib/debug/stats_data.h +1 -1
  111. data/src/core/lib/debug/trace.cc +24 -55
  112. data/src/core/lib/debug/trace.h +3 -1
  113. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +211 -0
  114. data/src/core/lib/event_engine/cf_engine/cf_engine.h +86 -0
  115. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +354 -0
  116. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +146 -0
  117. data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +79 -0
  118. data/src/core/lib/event_engine/default_event_engine.cc +13 -1
  119. data/src/core/lib/event_engine/default_event_engine_factory.cc +14 -2
  120. data/src/core/lib/event_engine/poller.h +2 -2
  121. data/src/core/lib/event_engine/posix.h +4 -0
  122. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -1
  123. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +7 -18
  124. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +9 -0
  125. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +33 -19
  126. data/src/core/lib/event_engine/posix_engine/posix_engine.h +2 -1
  127. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +33 -4
  128. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +10 -8
  129. data/src/core/lib/event_engine/posix_engine/timer_manager.h +1 -1
  130. data/src/core/lib/event_engine/shim.cc +7 -1
  131. data/src/core/lib/event_engine/{thread_pool.cc → thread_pool/original_thread_pool.cc} +28 -25
  132. data/src/core/lib/event_engine/{thread_pool.h → thread_pool/original_thread_pool.h} +11 -15
  133. data/src/core/lib/event_engine/thread_pool/thread_pool.h +50 -0
  134. data/src/core/lib/event_engine/{executor/executor.h → thread_pool/thread_pool_factory.cc} +17 -15
  135. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +489 -0
  136. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +249 -0
  137. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +166 -0
  138. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +108 -0
  139. data/src/core/lib/event_engine/windows/iocp.cc +4 -3
  140. data/src/core/lib/event_engine/windows/iocp.h +3 -3
  141. data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
  142. data/src/core/lib/event_engine/windows/win_socket.h +4 -4
  143. data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -10
  144. data/src/core/lib/event_engine/windows/windows_endpoint.h +3 -2
  145. data/src/core/lib/event_engine/windows/windows_engine.cc +19 -17
  146. data/src/core/lib/event_engine/windows/windows_engine.h +6 -6
  147. data/src/core/lib/event_engine/windows/windows_listener.cc +3 -3
  148. data/src/core/lib/event_engine/windows/windows_listener.h +3 -2
  149. data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +63 -0
  150. data/src/core/lib/event_engine/work_queue/basic_work_queue.h +71 -0
  151. data/src/core/lib/event_engine/work_queue/work_queue.h +62 -0
  152. data/src/core/lib/experiments/config.cc +38 -7
  153. data/src/core/lib/experiments/config.h +16 -0
  154. data/src/core/lib/experiments/experiments.cc +67 -20
  155. data/src/core/lib/experiments/experiments.h +27 -21
  156. data/src/core/lib/gpr/log_internal.h +55 -0
  157. data/src/core/lib/gprpp/crash.cc +10 -0
  158. data/src/core/lib/gprpp/crash.h +3 -0
  159. data/src/core/lib/gprpp/per_cpu.cc +33 -0
  160. data/src/core/lib/gprpp/per_cpu.h +29 -6
  161. data/src/core/lib/gprpp/time.cc +1 -0
  162. data/src/core/lib/iomgr/cfstream_handle.cc +1 -1
  163. data/src/core/lib/iomgr/endpoint_cfstream.cc +10 -8
  164. data/src/core/lib/iomgr/ev_apple.cc +12 -12
  165. data/src/core/lib/iomgr/ev_epoll1_linux.cc +10 -3
  166. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +15 -1
  167. data/src/core/lib/iomgr/iocp_windows.cc +24 -3
  168. data/src/core/lib/iomgr/iocp_windows.h +11 -0
  169. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +1 -1
  170. data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -2
  171. data/src/core/lib/iomgr/socket_windows.cc +61 -7
  172. data/src/core/lib/iomgr/socket_windows.h +9 -2
  173. data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -3
  174. data/src/core/lib/iomgr/tcp_server_posix.cc +182 -119
  175. data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -1
  176. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +21 -0
  177. data/src/core/lib/iomgr/tcp_server_windows.cc +1 -1
  178. data/src/core/lib/json/json.h +2 -166
  179. data/src/core/lib/json/json_object_loader.cc +8 -9
  180. data/src/core/lib/json/json_object_loader.h +25 -18
  181. data/src/core/lib/json/json_reader.cc +13 -6
  182. data/src/core/lib/json/json_util.cc +6 -11
  183. data/src/core/lib/json/json_writer.cc +7 -8
  184. data/src/core/lib/load_balancing/lb_policy.h +13 -0
  185. data/src/core/lib/load_balancing/lb_policy_registry.cc +2 -1
  186. data/src/core/lib/matchers/matchers.cc +3 -4
  187. data/src/core/lib/matchers/matchers.h +2 -1
  188. data/src/core/lib/promise/activity.cc +5 -0
  189. data/src/core/lib/promise/activity.h +10 -0
  190. data/src/core/lib/promise/detail/promise_factory.h +1 -1
  191. data/src/core/lib/promise/party.cc +31 -13
  192. data/src/core/lib/promise/party.h +11 -2
  193. data/src/core/lib/promise/pipe.h +9 -2
  194. data/src/core/lib/promise/prioritized_race.h +95 -0
  195. data/src/core/lib/promise/sleep.cc +2 -1
  196. data/src/core/lib/resolver/server_address.cc +0 -8
  197. data/src/core/lib/resolver/server_address.h +0 -6
  198. data/src/core/lib/resource_quota/memory_quota.cc +7 -7
  199. data/src/core/lib/resource_quota/memory_quota.h +1 -2
  200. data/src/core/lib/security/authorization/audit_logging.cc +98 -0
  201. data/src/core/lib/security/authorization/audit_logging.h +73 -0
  202. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +47 -2
  203. data/src/core/lib/security/authorization/grpc_authorization_engine.h +18 -1
  204. data/src/core/lib/security/authorization/rbac_policy.cc +36 -4
  205. data/src/core/lib/security/authorization/rbac_policy.h +19 -2
  206. data/src/core/lib/security/authorization/stdout_logger.cc +75 -0
  207. data/src/core/lib/security/authorization/stdout_logger.h +61 -0
  208. data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +8 -4
  209. data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +8 -18
  210. data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +14 -8
  211. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +19 -12
  212. data/src/core/lib/security/credentials/external/external_account_credentials.cc +4 -2
  213. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +1 -0
  214. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
  215. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -0
  216. data/src/core/lib/security/credentials/jwt/json_token.cc +15 -14
  217. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +4 -2
  218. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +1 -0
  219. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -0
  220. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +8 -0
  221. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +5 -1
  222. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -5
  223. data/src/core/lib/security/security_connector/ssl_utils.cc +2 -1
  224. data/src/core/lib/security/security_connector/ssl_utils.h +1 -1
  225. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +1 -1
  226. data/src/core/lib/security/util/json_util.cc +1 -0
  227. data/src/core/lib/service_config/service_config_call_data.h +49 -20
  228. data/src/core/lib/service_config/service_config_impl.cc +2 -1
  229. data/src/core/lib/surface/call.cc +38 -23
  230. data/src/core/lib/surface/completion_queue.cc +6 -2
  231. data/src/core/lib/surface/validate_metadata.cc +37 -22
  232. data/src/core/lib/surface/validate_metadata.h +13 -3
  233. data/src/core/lib/surface/version.cc +2 -2
  234. data/src/core/lib/transport/batch_builder.cc +15 -12
  235. data/src/core/lib/transport/batch_builder.h +39 -35
  236. data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -2
  237. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -0
  238. data/src/core/tsi/ssl_transport_security.cc +5 -2
  239. data/src/core/tsi/ssl_transport_security.h +13 -1
  240. data/src/ruby/ext/grpc/extconf.rb +8 -9
  241. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  242. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  243. data/src/ruby/lib/grpc/version.rb +1 -1
  244. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +9 -8
  245. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +1 -1
  246. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +3 -3
  247. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +10 -6
  248. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +7 -4
  249. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +6 -4
  250. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -1
  251. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +5 -9
  252. data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +4 -2
  253. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +31 -22
  254. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +29 -26
  255. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +8 -0
  256. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +189 -13
  257. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_openbsd.c +62 -0
  258. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_openbsd.c +31 -0
  259. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +6 -4
  260. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +795 -795
  261. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -5
  262. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +4 -0
  263. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +18 -6
  264. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +15 -7
  265. data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +1 -1
  266. data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa.c +1 -1
  267. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -0
  268. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/dh.c +3 -0
  269. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +24 -24
  270. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +1 -1
  271. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +7 -7
  272. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +74 -74
  273. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +1 -2
  274. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +11 -11
  275. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +12 -12
  276. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +14 -15
  277. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +1 -1
  278. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +10 -10
  279. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +23 -23
  280. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +13 -13
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +2 -2
  283. data/third_party/boringssl-with-bazel/src/crypto/{hkdf → fipsmodule/hkdf}/hkdf.c +1 -1
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +2 -10
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +1 -4
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +115 -133
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +12 -14
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +57 -47
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +1 -8
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/polyval.c +27 -28
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +11 -23
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +21 -16
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/padding.c +5 -288
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +143 -83
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +95 -183
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +71 -0
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +8 -0
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/kdf.c +33 -0
  299. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +162 -6
  300. data/third_party/boringssl-with-bazel/src/crypto/internal.h +18 -0
  301. data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +18 -11
  302. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +6 -13
  303. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +18 -14
  304. data/third_party/boringssl-with-bazel/src/crypto/{refcount_lock.c → refcount_no_threads.c} +3 -13
  305. data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +89 -0
  306. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +77 -0
  307. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_crypt.c +568 -0
  308. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +62 -0
  309. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +218 -44
  310. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +35 -0
  311. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +588 -39
  312. data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.c +27 -18
  313. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +1 -1
  314. data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +17 -39
  315. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +39 -48
  316. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +0 -140
  317. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +72 -23
  318. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -14
  319. data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.c +1 -1
  320. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
  321. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +1 -1
  322. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +33 -46
  323. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +1 -0
  324. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +3 -5
  325. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +14 -46
  326. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -26
  327. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +17 -10
  328. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +1 -1
  329. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +5 -7
  330. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +6 -4
  331. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +32 -1
  332. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +0 -4
  333. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -4
  334. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +3 -3
  335. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +28 -0
  336. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +2 -11
  337. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -3
  338. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +91 -1
  339. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +5 -0
  340. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +149 -20
  341. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +4 -0
  342. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +4 -0
  343. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +8 -0
  344. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +774 -615
  345. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +42 -10
  346. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +11 -6
  347. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +2 -4
  348. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +24 -16
  349. data/third_party/boringssl-with-bazel/src/ssl/internal.h +65 -18
  350. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +37 -18
  351. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +187 -193
  352. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +13 -129
  353. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +85 -10
  354. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +17 -4
  355. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +27 -19
  356. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +1 -1
  357. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +5 -21
  358. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +5 -2
  359. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_msvc.h +1281 -0
  360. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64_msvc.h +2002 -0
  361. data/third_party/cares/cares/include/ares.h +23 -1
  362. data/third_party/cares/cares/{src/lib → include}/ares_nameser.h +9 -7
  363. data/third_party/cares/cares/include/ares_rules.h +2 -2
  364. data/third_party/cares/cares/include/ares_version.h +3 -3
  365. data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +266 -0
  366. data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +240 -0
  367. data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +49 -80
  368. data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +37 -43
  369. data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +12 -4
  370. data/third_party/cares/cares/src/lib/ares_data.c +16 -0
  371. data/third_party/cares/cares/src/lib/ares_data.h +7 -0
  372. data/third_party/cares/cares/src/lib/ares_destroy.c +8 -0
  373. data/third_party/cares/cares/src/lib/ares_expand_name.c +17 -6
  374. data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +1 -0
  375. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +156 -78
  376. data/third_party/cares/cares/src/lib/ares_gethostbyname.c +130 -326
  377. data/third_party/cares/cares/src/lib/ares_init.c +97 -485
  378. data/third_party/cares/cares/src/lib/ares_library_init.c +2 -89
  379. data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +23 -142
  380. data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +22 -142
  381. data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +184 -0
  382. data/third_party/cares/cares/src/lib/ares_private.h +30 -16
  383. data/third_party/cares/cares/src/lib/ares_process.c +55 -16
  384. data/third_party/cares/cares/src/lib/ares_query.c +1 -35
  385. data/third_party/cares/cares/src/lib/ares_rand.c +279 -0
  386. data/third_party/cares/cares/src/lib/ares_send.c +5 -7
  387. data/third_party/cares/cares/src/lib/ares_strdup.c +12 -19
  388. data/third_party/cares/cares/src/lib/ares_strsplit.c +44 -128
  389. data/third_party/cares/cares/src/lib/ares_strsplit.h +9 -10
  390. data/third_party/cares/cares/src/lib/inet_net_pton.c +78 -116
  391. data/third_party/cares/cares/src/tools/ares_getopt.h +53 -0
  392. metadata +50 -12
  393. data/src/core/ext/filters/client_channel/health/health_check_client.cc +0 -175
  394. data/src/core/ext/filters/client_channel/health/health_check_client.h +0 -43
  395. data/third_party/cares/cares/src/lib/ares_library_init.h +0 -43
@@ -45,6 +45,8 @@
45
45
  #include "upb/upb.hpp"
46
46
  #include "xds/type/v3/typed_struct.upb.h"
47
47
 
48
+ #include <grpc/support/json.h>
49
+
48
50
  #include "src/core/ext/xds/upb_utils.h"
49
51
  #include "src/core/ext/xds/xds_bootstrap_grpc.h"
50
52
  #include "src/core/ext/xds/xds_client.h"
@@ -486,7 +488,7 @@ absl::optional<XdsExtension> ExtractXdsExtension(
486
488
  errors, absl::StrCat(".value[", extension.type, "]"));
487
489
  auto* protobuf_struct = xds_type_v3_TypedStruct_value(typed_struct);
488
490
  if (protobuf_struct == nullptr) {
489
- extension.value = Json::Object(); // Default to empty object.
491
+ extension.value = Json::FromObject({}); // Default to empty object.
490
492
  } else {
491
493
  auto json = ParseProtobufStructToJson(context, protobuf_struct);
492
494
  if (!json.ok()) {
@@ -34,6 +34,7 @@
34
34
  #include "google/protobuf/wrappers.upb.h"
35
35
 
36
36
  #include <grpc/status.h>
37
+ #include <grpc/support/json.h>
37
38
 
38
39
  #include "src/core/ext/filters/fault_injection/fault_injection_filter.h"
39
40
  #include "src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h"
@@ -139,14 +140,14 @@ XdsHttpFaultFilter::GenerateFilterConfig(
139
140
  }
140
141
  // Set the abort_code, even if it's OK
141
142
  fault_injection_policy_json["abortCode"] =
142
- grpc_status_code_to_string(abort_grpc_status_code);
143
+ Json::FromString(grpc_status_code_to_string(abort_grpc_status_code));
143
144
  // Set the headers if we enabled header abort injection control
144
145
  if (envoy_extensions_filters_http_fault_v3_FaultAbort_has_header_abort(
145
146
  fault_abort)) {
146
147
  fault_injection_policy_json["abortCodeHeader"] =
147
- "x-envoy-fault-abort-grpc-request";
148
+ Json::FromString("x-envoy-fault-abort-grpc-request");
148
149
  fault_injection_policy_json["abortPercentageHeader"] =
149
- "x-envoy-fault-abort-percentage";
150
+ Json::FromString("x-envoy-fault-abort-percentage");
150
151
  }
151
152
  // Set the fraction percent
152
153
  auto* percent =
@@ -154,9 +155,9 @@ XdsHttpFaultFilter::GenerateFilterConfig(
154
155
  fault_abort);
155
156
  if (percent != nullptr) {
156
157
  fault_injection_policy_json["abortPercentageNumerator"] =
157
- envoy_type_v3_FractionalPercent_numerator(percent);
158
+ Json::FromNumber(envoy_type_v3_FractionalPercent_numerator(percent));
158
159
  fault_injection_policy_json["abortPercentageDenominator"] =
159
- GetDenominator(percent);
160
+ Json::FromNumber(GetDenominator(percent));
160
161
  }
161
162
  }
162
163
  // Section 2: Parse the delay injection config
@@ -171,15 +172,16 @@ XdsHttpFaultFilter::GenerateFilterConfig(
171
172
  if (delay_duration != nullptr) {
172
173
  ValidationErrors::ScopedField field(errors, ".fixed_delay");
173
174
  Duration duration = ParseDuration(delay_duration, errors);
174
- fault_injection_policy_json["delay"] = duration.ToJsonString();
175
+ fault_injection_policy_json["delay"] =
176
+ Json::FromString(duration.ToJsonString());
175
177
  }
176
178
  // Set the headers if we enabled header delay injection control
177
179
  if (envoy_extensions_filters_common_fault_v3_FaultDelay_has_header_delay(
178
180
  fault_delay)) {
179
181
  fault_injection_policy_json["delayHeader"] =
180
- "x-envoy-fault-delay-request";
182
+ Json::FromString("x-envoy-fault-delay-request");
181
183
  fault_injection_policy_json["delayPercentageHeader"] =
182
- "x-envoy-fault-delay-request-percentage";
184
+ Json::FromString("x-envoy-fault-delay-request-percentage");
183
185
  }
184
186
  // Set the fraction percent
185
187
  auto* percent =
@@ -187,9 +189,9 @@ XdsHttpFaultFilter::GenerateFilterConfig(
187
189
  fault_delay);
188
190
  if (percent != nullptr) {
189
191
  fault_injection_policy_json["delayPercentageNumerator"] =
190
- envoy_type_v3_FractionalPercent_numerator(percent);
192
+ Json::FromNumber(envoy_type_v3_FractionalPercent_numerator(percent));
191
193
  fault_injection_policy_json["delayPercentageDenominator"] =
192
- GetDenominator(percent);
194
+ Json::FromNumber(GetDenominator(percent));
193
195
  }
194
196
  }
195
197
  // Section 3: Parse the maximum active faults
@@ -198,10 +200,10 @@ XdsHttpFaultFilter::GenerateFilterConfig(
198
200
  http_fault);
199
201
  if (max_fault_wrapper != nullptr) {
200
202
  fault_injection_policy_json["maxFaults"] =
201
- google_protobuf_UInt32Value_value(max_fault_wrapper);
203
+ Json::FromNumber(google_protobuf_UInt32Value_value(max_fault_wrapper));
202
204
  }
203
205
  return FilterConfig{ConfigProtoName(),
204
- std::move(fault_injection_policy_json)};
206
+ Json::FromObject(std::move(fault_injection_policy_json))};
205
207
  }
206
208
 
207
209
  absl::optional<XdsHttpFilterImpl::FilterConfig>
@@ -225,7 +227,8 @@ ChannelArgs XdsHttpFaultFilter::ModifyChannelArgs(
225
227
  absl::StatusOr<XdsHttpFilterImpl::ServiceConfigJsonEntry>
226
228
  XdsHttpFaultFilter::GenerateServiceConfig(
227
229
  const FilterConfig& hcm_filter_config,
228
- const FilterConfig* filter_config_override) const {
230
+ const FilterConfig* filter_config_override,
231
+ absl::string_view /*filter_name*/) const {
229
232
  Json policy_json = filter_config_override != nullptr
230
233
  ? filter_config_override->config
231
234
  : hcm_filter_config.config;
@@ -48,7 +48,8 @@ class XdsHttpFaultFilter : public XdsHttpFilterImpl {
48
48
  ChannelArgs ModifyChannelArgs(const ChannelArgs& args) const override;
49
49
  absl::StatusOr<ServiceConfigJsonEntry> GenerateServiceConfig(
50
50
  const FilterConfig& hcm_filter_config,
51
- const FilterConfig* filter_config_override) const override;
51
+ const FilterConfig* filter_config_override,
52
+ absl::string_view filter_name) const override;
52
53
  bool IsSupportedOnClients() const override { return true; }
53
54
  bool IsSupportedOnServers() const override { return false; }
54
55
  };
@@ -112,7 +112,8 @@ class XdsHttpFilterImpl {
112
112
  // there is no override in any of those locations.
113
113
  virtual absl::StatusOr<ServiceConfigJsonEntry> GenerateServiceConfig(
114
114
  const FilterConfig& hcm_filter_config,
115
- const FilterConfig* filter_config_override) const = 0;
115
+ const FilterConfig* filter_config_override,
116
+ absl::string_view filter_name) const = 0;
116
117
 
117
118
  // Returns true if the filter is supported on clients; false otherwise
118
119
  virtual bool IsSupportedOnClients() const = 0;
@@ -138,7 +139,8 @@ class XdsHttpRouterFilter : public XdsHttpFilterImpl {
138
139
  const grpc_channel_filter* channel_filter() const override { return nullptr; }
139
140
  absl::StatusOr<ServiceConfigJsonEntry> GenerateServiceConfig(
140
141
  const FilterConfig& /*hcm_filter_config*/,
141
- const FilterConfig* /*filter_config_override*/) const override {
142
+ const FilterConfig* /*filter_config_override*/,
143
+ absl::string_view /*filter_name*/) const override {
142
144
  // This will never be called, since channel_filter() returns null.
143
145
  return absl::UnimplementedError("router filter should never be called");
144
146
  }
@@ -19,9 +19,9 @@
19
19
  #include "src/core/ext/xds/xds_http_rbac_filter.h"
20
20
 
21
21
  #include <stddef.h>
22
+ #include <stdint.h>
22
23
 
23
24
  #include <algorithm>
24
- #include <cstdint>
25
25
  #include <string>
26
26
  #include <utility>
27
27
 
@@ -42,10 +42,17 @@
42
42
  #include "google/protobuf/wrappers.upb.h"
43
43
  #include "upb/collections/map.h"
44
44
 
45
+ #include <grpc/support/json.h>
46
+
45
47
  #include "src/core/ext/filters/rbac/rbac_filter.h"
46
48
  #include "src/core/ext/filters/rbac/rbac_service_config_parser.h"
47
49
  #include "src/core/ext/xds/upb_utils.h"
50
+ #include "src/core/ext/xds/xds_audit_logger_registry.h"
51
+ #include "src/core/ext/xds/xds_bootstrap_grpc.h"
52
+ #include "src/core/ext/xds/xds_client.h"
48
53
  #include "src/core/lib/channel/channel_args.h"
54
+ #include "src/core/lib/gpr/string.h"
55
+ #include "src/core/lib/gprpp/env.h"
49
56
  #include "src/core/lib/json/json.h"
50
57
  #include "src/core/lib/json/json_writer.h"
51
58
 
@@ -53,16 +60,27 @@ namespace grpc_core {
53
60
 
54
61
  namespace {
55
62
 
63
+ // TODO(lwge): Remove once the feature is stable.
64
+ bool XdsRbacAuditLoggingEnabled() {
65
+ auto value = GetEnv("GRPC_EXPERIMENTAL_XDS_RBAC_AUDIT_LOGGING");
66
+ if (!value.has_value()) return false;
67
+ bool parsed_value;
68
+ bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value);
69
+ return parse_succeeded && parsed_value;
70
+ }
71
+
56
72
  Json ParseRegexMatcherToJson(
57
73
  const envoy_type_matcher_v3_RegexMatcher* regex_matcher) {
58
- return Json::Object(
59
- {{"regex", UpbStringToStdString(envoy_type_matcher_v3_RegexMatcher_regex(
60
- regex_matcher))}});
74
+ return Json::FromObject(
75
+ {{"regex",
76
+ Json::FromString(UpbStringToStdString(
77
+ envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher)))}});
61
78
  }
62
79
 
63
80
  Json ParseInt64RangeToJson(const envoy_type_v3_Int64Range* range) {
64
- return Json::Object{{"start", envoy_type_v3_Int64Range_start(range)},
65
- {"end", envoy_type_v3_Int64Range_end(range)}};
81
+ return Json::FromObject(
82
+ {{"start", Json::FromNumber(envoy_type_v3_Int64Range_start(range))},
83
+ {"end", Json::FromNumber(envoy_type_v3_Int64Range_end(range))}});
66
84
  }
67
85
 
68
86
  Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header,
@@ -77,13 +95,13 @@ Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header,
77
95
  } else if (absl::StartsWith(name, "grpc-")) {
78
96
  errors->AddError("'grpc-' prefixes not allowed in header");
79
97
  }
80
- header_json.emplace("name", std::move(name));
98
+ header_json.emplace("name", Json::FromString(std::move(name)));
81
99
  }
82
100
  if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) {
83
101
  header_json.emplace(
84
102
  "exactMatch",
85
- UpbStringToStdString(
86
- envoy_config_route_v3_HeaderMatcher_exact_match(header)));
103
+ Json::FromString(UpbStringToStdString(
104
+ envoy_config_route_v3_HeaderMatcher_exact_match(header))));
87
105
  } else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(header)) {
88
106
  header_json.emplace(
89
107
  "safeRegexMatch",
@@ -97,28 +115,30 @@ Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header,
97
115
  } else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) {
98
116
  header_json.emplace(
99
117
  "presentMatch",
100
- envoy_config_route_v3_HeaderMatcher_present_match(header));
118
+ Json::FromBool(
119
+ envoy_config_route_v3_HeaderMatcher_present_match(header)));
101
120
  } else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) {
102
121
  header_json.emplace(
103
122
  "prefixMatch",
104
- UpbStringToStdString(
105
- envoy_config_route_v3_HeaderMatcher_prefix_match(header)));
123
+ Json::FromString(UpbStringToStdString(
124
+ envoy_config_route_v3_HeaderMatcher_prefix_match(header))));
106
125
  } else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) {
107
126
  header_json.emplace(
108
127
  "suffixMatch",
109
- UpbStringToStdString(
110
- envoy_config_route_v3_HeaderMatcher_suffix_match(header)));
128
+ Json::FromString(UpbStringToStdString(
129
+ envoy_config_route_v3_HeaderMatcher_suffix_match(header))));
111
130
  } else if (envoy_config_route_v3_HeaderMatcher_has_contains_match(header)) {
112
131
  header_json.emplace(
113
132
  "containsMatch",
114
- UpbStringToStdString(
115
- envoy_config_route_v3_HeaderMatcher_contains_match(header)));
133
+ Json::FromString(UpbStringToStdString(
134
+ envoy_config_route_v3_HeaderMatcher_contains_match(header))));
116
135
  } else {
117
136
  errors->AddError("invalid route header matcher specified");
118
137
  }
119
- header_json.emplace("invertMatch",
120
- envoy_config_route_v3_HeaderMatcher_invert_match(header));
121
- return header_json;
138
+ header_json.emplace(
139
+ "invertMatch",
140
+ Json::FromBool(envoy_config_route_v3_HeaderMatcher_invert_match(header)));
141
+ return Json::FromObject(std::move(header_json));
122
142
  }
123
143
 
124
144
  Json ParseStringMatcherToJson(
@@ -127,30 +147,31 @@ Json ParseStringMatcherToJson(
127
147
  Json::Object json;
128
148
  if (envoy_type_matcher_v3_StringMatcher_has_exact(matcher)) {
129
149
  json.emplace("exact",
130
- UpbStringToStdString(
131
- envoy_type_matcher_v3_StringMatcher_exact(matcher)));
150
+ Json::FromString(UpbStringToStdString(
151
+ envoy_type_matcher_v3_StringMatcher_exact(matcher))));
132
152
  } else if (envoy_type_matcher_v3_StringMatcher_has_prefix(matcher)) {
133
153
  json.emplace("prefix",
134
- UpbStringToStdString(
135
- envoy_type_matcher_v3_StringMatcher_prefix(matcher)));
154
+ Json::FromString(UpbStringToStdString(
155
+ envoy_type_matcher_v3_StringMatcher_prefix(matcher))));
136
156
  } else if (envoy_type_matcher_v3_StringMatcher_has_suffix(matcher)) {
137
157
  json.emplace("suffix",
138
- UpbStringToStdString(
139
- envoy_type_matcher_v3_StringMatcher_suffix(matcher)));
158
+ Json::FromString(UpbStringToStdString(
159
+ envoy_type_matcher_v3_StringMatcher_suffix(matcher))));
140
160
  } else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(matcher)) {
141
161
  json.emplace("safeRegex",
142
162
  ParseRegexMatcherToJson(
143
163
  envoy_type_matcher_v3_StringMatcher_safe_regex(matcher)));
144
164
  } else if (envoy_type_matcher_v3_StringMatcher_has_contains(matcher)) {
145
165
  json.emplace("contains",
146
- UpbStringToStdString(
147
- envoy_type_matcher_v3_StringMatcher_contains(matcher)));
166
+ Json::FromString(UpbStringToStdString(
167
+ envoy_type_matcher_v3_StringMatcher_contains(matcher))));
148
168
  } else {
149
169
  errors->AddError("invalid match pattern");
150
170
  }
151
- json.emplace("ignoreCase",
152
- envoy_type_matcher_v3_StringMatcher_ignore_case(matcher));
153
- return json;
171
+ json.emplace(
172
+ "ignoreCase",
173
+ Json::FromBool(envoy_type_matcher_v3_StringMatcher_ignore_case(matcher)));
174
+ return Json::FromObject(std::move(json));
154
175
  }
155
176
 
156
177
  Json ParsePathMatcherToJson(const envoy_type_matcher_v3_PathMatcher* matcher,
@@ -162,30 +183,32 @@ Json ParsePathMatcherToJson(const envoy_type_matcher_v3_PathMatcher* matcher,
162
183
  return Json();
163
184
  }
164
185
  Json path_json = ParseStringMatcherToJson(path, errors);
165
- return Json::Object{{"path", std::move(path_json)}};
186
+ return Json::FromObject({{"path", std::move(path_json)}});
166
187
  }
167
188
 
168
189
  Json ParseCidrRangeToJson(const envoy_config_core_v3_CidrRange* range) {
169
190
  Json::Object json;
170
191
  json.emplace("addressPrefix",
171
- UpbStringToStdString(
172
- envoy_config_core_v3_CidrRange_address_prefix(range)));
192
+ Json::FromString(UpbStringToStdString(
193
+ envoy_config_core_v3_CidrRange_address_prefix(range))));
173
194
  const auto* prefix_len = envoy_config_core_v3_CidrRange_prefix_len(range);
174
195
  if (prefix_len != nullptr) {
175
- json.emplace("prefixLen", google_protobuf_UInt32Value_value(prefix_len));
196
+ json.emplace(
197
+ "prefixLen",
198
+ Json::FromNumber(google_protobuf_UInt32Value_value(prefix_len)));
176
199
  }
177
- return json;
200
+ return Json::FromObject(std::move(json));
178
201
  }
179
202
 
180
203
  Json ParseMetadataMatcherToJson(
181
204
  const envoy_type_matcher_v3_MetadataMatcher* metadata_matcher) {
182
- Json::Object json;
183
205
  // The fields "filter", "path" and "value" are irrelevant to gRPC as per
184
206
  // https://github.com/grpc/proposal/blob/master/A41-xds-rbac.md and are not
185
207
  // being parsed.
186
- json.emplace("invert",
187
- envoy_type_matcher_v3_MetadataMatcher_invert(metadata_matcher));
188
- return json;
208
+ return Json::FromObject({
209
+ {"invert", Json::FromBool(envoy_type_matcher_v3_MetadataMatcher_invert(
210
+ metadata_matcher))},
211
+ });
189
212
  }
190
213
 
191
214
  Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission,
@@ -205,7 +228,8 @@ Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission,
205
228
  Json permission_json = ParsePermissionToJson(rules[i], errors);
206
229
  rules_json.emplace_back(std::move(permission_json));
207
230
  }
208
- return Json::Object({{"rules", std::move(rules_json)}});
231
+ return Json::FromObject(
232
+ {{"rules", Json::FromArray(std::move(rules_json))}});
209
233
  };
210
234
  if (envoy_config_rbac_v3_Permission_has_and_rules(permission)) {
211
235
  ValidationErrors::ScopedField field(errors, ".and_permission");
@@ -219,8 +243,8 @@ Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission,
219
243
  Json permission_set_json = parse_permission_set_to_json(or_rules);
220
244
  permission_json.emplace("orRules", std::move(permission_set_json));
221
245
  } else if (envoy_config_rbac_v3_Permission_has_any(permission)) {
222
- permission_json.emplace("any",
223
- envoy_config_rbac_v3_Permission_any(permission));
246
+ permission_json.emplace(
247
+ "any", Json::FromBool(envoy_config_rbac_v3_Permission_any(permission)));
224
248
  } else if (envoy_config_rbac_v3_Permission_has_header(permission)) {
225
249
  ValidationErrors::ScopedField field(errors, ".header");
226
250
  Json header_json = ParseHeaderMatcherToJson(
@@ -239,7 +263,8 @@ Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission,
239
263
  } else if (envoy_config_rbac_v3_Permission_has_destination_port(permission)) {
240
264
  permission_json.emplace(
241
265
  "destinationPort",
242
- envoy_config_rbac_v3_Permission_destination_port(permission));
266
+ Json::FromNumber(
267
+ envoy_config_rbac_v3_Permission_destination_port(permission)));
243
268
  } else if (envoy_config_rbac_v3_Permission_has_metadata(permission)) {
244
269
  permission_json.emplace(
245
270
  "metadata", ParseMetadataMatcherToJson(
@@ -260,7 +285,7 @@ Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission,
260
285
  } else {
261
286
  errors->AddError("invalid rule");
262
287
  }
263
- return permission_json;
288
+ return Json::FromObject(std::move(permission_json));
264
289
  }
265
290
 
266
291
  Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal,
@@ -280,7 +305,7 @@ Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal,
280
305
  Json principal_json = ParsePrincipalToJson(ids[i], errors);
281
306
  ids_json.emplace_back(std::move(principal_json));
282
307
  }
283
- return Json::Object({{"ids", std::move(ids_json)}});
308
+ return Json::FromObject({{"ids", Json::FromArray(std::move(ids_json))}});
284
309
  };
285
310
  if (envoy_config_rbac_v3_Principal_has_and_ids(principal)) {
286
311
  ValidationErrors::ScopedField field(errors, ".and_ids");
@@ -293,8 +318,8 @@ Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal,
293
318
  Json principal_set_json = parse_principal_set_to_json(or_rules);
294
319
  principal_json.emplace("orIds", std::move(principal_set_json));
295
320
  } else if (envoy_config_rbac_v3_Principal_has_any(principal)) {
296
- principal_json.emplace("any",
297
- envoy_config_rbac_v3_Principal_any(principal));
321
+ principal_json.emplace(
322
+ "any", Json::FromBool(envoy_config_rbac_v3_Principal_any(principal)));
298
323
  } else if (envoy_config_rbac_v3_Principal_has_authenticated(principal)) {
299
324
  Json::Object authenticated_json;
300
325
  const auto* principal_name =
@@ -307,7 +332,8 @@ Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal,
307
332
  ParseStringMatcherToJson(principal_name, errors);
308
333
  authenticated_json["principalName"] = std::move(principal_name_json);
309
334
  }
310
- principal_json["authenticated"] = std::move(authenticated_json);
335
+ principal_json["authenticated"] =
336
+ Json::FromObject(std::move(authenticated_json));
311
337
  } else if (envoy_config_rbac_v3_Principal_has_source_ip(principal)) {
312
338
  principal_json.emplace(
313
339
  "sourceIp", ParseCidrRangeToJson(
@@ -343,7 +369,7 @@ Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal,
343
369
  } else {
344
370
  errors->AddError("invalid rule");
345
371
  }
346
- return principal_json;
372
+ return Json::FromObject(std::move(principal_json));
347
373
  }
348
374
 
349
375
  Json ParsePolicyToJson(const envoy_config_rbac_v3_Policy* policy,
@@ -359,7 +385,8 @@ Json ParsePolicyToJson(const envoy_config_rbac_v3_Policy* policy,
359
385
  Json permission_json = ParsePermissionToJson(permissions[i], errors);
360
386
  permissions_json.emplace_back(std::move(permission_json));
361
387
  }
362
- policy_json.emplace("permissions", std::move(permissions_json));
388
+ policy_json.emplace("permissions",
389
+ Json::FromArray(std::move(permissions_json)));
363
390
  Json::Array principals_json;
364
391
  const envoy_config_rbac_v3_Principal* const* principals =
365
392
  envoy_config_rbac_v3_Policy_principals(policy, &size);
@@ -369,7 +396,8 @@ Json ParsePolicyToJson(const envoy_config_rbac_v3_Policy* policy,
369
396
  Json principal_json = ParsePrincipalToJson(principals[i], errors);
370
397
  principals_json.emplace_back(std::move(principal_json));
371
398
  }
372
- policy_json.emplace("principals", std::move(principals_json));
399
+ policy_json.emplace("principals",
400
+ Json::FromArray(std::move(principals_json)));
373
401
  if (envoy_config_rbac_v3_Policy_has_condition(policy)) {
374
402
  ValidationErrors::ScopedField field(errors, ".condition");
375
403
  errors->AddError("condition not supported");
@@ -378,10 +406,33 @@ Json ParsePolicyToJson(const envoy_config_rbac_v3_Policy* policy,
378
406
  ValidationErrors::ScopedField field(errors, ".checked_condition");
379
407
  errors->AddError("checked condition not supported");
380
408
  }
381
- return policy_json;
409
+ return Json::FromObject(std::move(policy_json));
410
+ }
411
+
412
+ Json ParseAuditLoggerConfigsToJson(
413
+ const XdsResourceType::DecodeContext& context,
414
+ const envoy_config_rbac_v3_RBAC_AuditLoggingOptions* audit_logging_options,
415
+ ValidationErrors* errors) {
416
+ Json::Array logger_configs_json;
417
+ size_t size;
418
+ const auto& registry =
419
+ static_cast<const GrpcXdsBootstrap&>(context.client->bootstrap())
420
+ .audit_logger_registry();
421
+ const envoy_config_rbac_v3_RBAC_AuditLoggingOptions_AuditLoggerConfig* const*
422
+ logger_configs =
423
+ envoy_config_rbac_v3_RBAC_AuditLoggingOptions_logger_configs(
424
+ audit_logging_options, &size);
425
+ for (size_t i = 0; i < size; ++i) {
426
+ ValidationErrors::ScopedField field(
427
+ errors, absl::StrCat(".logger_configs[", i, "]"));
428
+ logger_configs_json.emplace_back(registry.ConvertXdsAuditLoggerConfig(
429
+ context, logger_configs[i], errors));
430
+ }
431
+ return Json::FromArray(logger_configs_json);
382
432
  }
383
433
 
384
- Json ParseHttpRbacToJson(const envoy_extensions_filters_http_rbac_v3_RBAC* rbac,
434
+ Json ParseHttpRbacToJson(const XdsResourceType::DecodeContext& context,
435
+ const envoy_extensions_filters_http_rbac_v3_RBAC* rbac,
385
436
  ValidationErrors* errors) {
386
437
  Json::Object rbac_json;
387
438
  const auto* rules = envoy_extensions_filters_http_rbac_v3_RBAC_rules(rbac);
@@ -390,10 +441,11 @@ Json ParseHttpRbacToJson(const envoy_extensions_filters_http_rbac_v3_RBAC* rbac,
390
441
  int action = envoy_config_rbac_v3_RBAC_action(rules);
391
442
  // Treat Log action as RBAC being absent
392
443
  if (action == envoy_config_rbac_v3_RBAC_LOG) {
393
- return rbac_json;
444
+ return Json::FromObject({});
394
445
  }
395
446
  Json::Object inner_rbac_json;
396
- inner_rbac_json.emplace("action", envoy_config_rbac_v3_RBAC_action(rules));
447
+ inner_rbac_json.emplace(
448
+ "action", Json::FromNumber(envoy_config_rbac_v3_RBAC_action(rules)));
397
449
  if (envoy_config_rbac_v3_RBAC_policies_size(rules) != 0) {
398
450
  Json::Object policies_object;
399
451
  size_t iter = kUpb_Map_Begin;
@@ -410,11 +462,40 @@ Json ParseHttpRbacToJson(const envoy_extensions_filters_http_rbac_v3_RBAC* rbac,
410
462
  envoy_config_rbac_v3_RBAC_PoliciesEntry_value(entry), errors);
411
463
  policies_object.emplace(std::string(key), std::move(policy));
412
464
  }
413
- inner_rbac_json.emplace("policies", std::move(policies_object));
465
+ inner_rbac_json.emplace("policies",
466
+ Json::FromObject(std::move(policies_object)));
467
+ }
468
+ // Flatten the nested messages defined in rbac.proto
469
+ if (XdsRbacAuditLoggingEnabled() &&
470
+ envoy_config_rbac_v3_RBAC_has_audit_logging_options(rules)) {
471
+ ValidationErrors::ScopedField field(errors, ".audit_logging_options");
472
+ const auto* audit_logging_options =
473
+ envoy_config_rbac_v3_RBAC_audit_logging_options(rules);
474
+ int32_t audit_condition =
475
+ envoy_config_rbac_v3_RBAC_AuditLoggingOptions_audit_condition(
476
+ audit_logging_options);
477
+ switch (audit_condition) {
478
+ case envoy_config_rbac_v3_RBAC_AuditLoggingOptions_NONE:
479
+ case envoy_config_rbac_v3_RBAC_AuditLoggingOptions_ON_DENY:
480
+ case envoy_config_rbac_v3_RBAC_AuditLoggingOptions_ON_ALLOW:
481
+ case envoy_config_rbac_v3_RBAC_AuditLoggingOptions_ON_DENY_AND_ALLOW:
482
+ inner_rbac_json.emplace("audit_condition",
483
+ Json::FromNumber(audit_condition));
484
+ break;
485
+ default:
486
+ ValidationErrors::ScopedField field(errors, ".audit_condition");
487
+ errors->AddError("invalid audit condition");
488
+ }
489
+ if (envoy_config_rbac_v3_RBAC_AuditLoggingOptions_has_logger_configs(
490
+ audit_logging_options)) {
491
+ inner_rbac_json.emplace("audit_loggers",
492
+ ParseAuditLoggerConfigsToJson(
493
+ context, audit_logging_options, errors));
494
+ }
414
495
  }
415
- rbac_json.emplace("rules", std::move(inner_rbac_json));
496
+ rbac_json.emplace("rules", Json::FromObject(std::move(inner_rbac_json)));
416
497
  }
417
- return rbac_json;
498
+ return Json::FromObject(std::move(rbac_json));
418
499
  }
419
500
 
420
501
  } // namespace
@@ -448,7 +529,8 @@ XdsHttpRbacFilter::GenerateFilterConfig(
448
529
  errors->AddError("could not parse HTTP RBAC filter config");
449
530
  return absl::nullopt;
450
531
  }
451
- return FilterConfig{ConfigProtoName(), ParseHttpRbacToJson(rbac, errors)};
532
+ return FilterConfig{ConfigProtoName(),
533
+ ParseHttpRbacToJson(context, rbac, errors)};
452
534
  }
453
535
 
454
536
  absl::optional<XdsHttpFilterImpl::FilterConfig>
@@ -473,10 +555,10 @@ XdsHttpRbacFilter::GenerateFilterConfigOverride(
473
555
  const auto* rbac =
474
556
  envoy_extensions_filters_http_rbac_v3_RBACPerRoute_rbac(rbac_per_route);
475
557
  if (rbac == nullptr) {
476
- rbac_json = Json::Object();
558
+ rbac_json = Json::FromObject({});
477
559
  } else {
478
560
  ValidationErrors::ScopedField field(errors, ".rbac");
479
- rbac_json = ParseHttpRbacToJson(rbac, errors);
561
+ rbac_json = ParseHttpRbacToJson(context, rbac, errors);
480
562
  }
481
563
  return FilterConfig{OverrideConfigProtoName(), std::move(rbac_json)};
482
564
  }
@@ -493,12 +575,17 @@ ChannelArgs XdsHttpRbacFilter::ModifyChannelArgs(
493
575
  absl::StatusOr<XdsHttpFilterImpl::ServiceConfigJsonEntry>
494
576
  XdsHttpRbacFilter::GenerateServiceConfig(
495
577
  const FilterConfig& hcm_filter_config,
496
- const FilterConfig* filter_config_override) const {
497
- Json policy_json = filter_config_override != nullptr
498
- ? filter_config_override->config
499
- : hcm_filter_config.config;
500
- // The policy JSON may be empty, that's allowed.
501
- return ServiceConfigJsonEntry{"rbacPolicy", JsonDump(policy_json)};
578
+ const FilterConfig* filter_config_override,
579
+ absl::string_view filter_name) const {
580
+ const Json& policy_json = filter_config_override != nullptr
581
+ ? filter_config_override->config
582
+ : hcm_filter_config.config;
583
+ auto json_object = policy_json.object();
584
+ json_object.emplace("filter_name",
585
+ Json::FromString(std::string(filter_name)));
586
+ // The policy JSON may be empty other than the filter name, that's allowed.
587
+ return ServiceConfigJsonEntry{"rbacPolicy",
588
+ JsonDump(Json::FromObject(json_object))};
502
589
  }
503
590
 
504
591
  } // namespace grpc_core
@@ -48,7 +48,8 @@ class XdsHttpRbacFilter : public XdsHttpFilterImpl {
48
48
  ChannelArgs ModifyChannelArgs(const ChannelArgs& args) const override;
49
49
  absl::StatusOr<ServiceConfigJsonEntry> GenerateServiceConfig(
50
50
  const FilterConfig& hcm_filter_config,
51
- const FilterConfig* filter_config_override) const override;
51
+ const FilterConfig* filter_config_override,
52
+ absl::string_view filter_name) const override;
52
53
  bool IsSupportedOnClients() const override { return false; }
53
54
  bool IsSupportedOnServers() const override { return true; }
54
55
  };
@@ -31,6 +31,8 @@
31
31
  #include "envoy/extensions/http/stateful_session/cookie/v3/cookie.upbdefs.h"
32
32
  #include "envoy/type/http/v3/cookie.upb.h"
33
33
 
34
+ #include <grpc/support/json.h>
35
+
34
36
  #include "src/core/ext/filters/stateful_session/stateful_session_filter.h"
35
37
  #include "src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h"
36
38
  #include "src/core/ext/xds/upb_utils.h"
@@ -119,20 +121,20 @@ Json::Object ValidateStatefulSession(
119
121
  ValidationErrors::ScopedField field(errors, ".name");
120
122
  errors->AddError("field not present");
121
123
  }
122
- cookie_config["name"] = std::move(cookie_name);
124
+ cookie_config["name"] = Json::FromString(std::move(cookie_name));
123
125
  // ttl
124
126
  {
125
127
  ValidationErrors::ScopedField field(errors, ".ttl");
126
128
  const auto* duration = envoy_type_http_v3_Cookie_ttl(cookie);
127
129
  if (duration != nullptr) {
128
130
  Duration ttl = ParseDuration(duration, errors);
129
- cookie_config["ttl"] = ttl.ToJsonString();
131
+ cookie_config["ttl"] = Json::FromString(ttl.ToJsonString());
130
132
  }
131
133
  }
132
134
  // path
133
135
  std::string path =
134
136
  UpbStringToStdString(envoy_type_http_v3_Cookie_path(cookie));
135
- if (!path.empty()) cookie_config["path"] = std::move(path);
137
+ if (!path.empty()) cookie_config["path"] = Json::FromString(std::move(path));
136
138
  return cookie_config;
137
139
  }
138
140
 
@@ -156,9 +158,9 @@ XdsHttpStatefulSessionFilter::GenerateFilterConfig(
156
158
  errors->AddError("could not parse stateful session filter config");
157
159
  return absl::nullopt;
158
160
  }
159
- return FilterConfig{
160
- ConfigProtoName(),
161
- ValidateStatefulSession(context, stateful_session, errors)};
161
+ return FilterConfig{ConfigProtoName(),
162
+ Json::FromObject(ValidateStatefulSession(
163
+ context, stateful_session, errors))};
162
164
  }
163
165
 
164
166
  absl::optional<XdsHttpFilterImpl::FilterConfig>
@@ -192,7 +194,8 @@ XdsHttpStatefulSessionFilter::GenerateFilterConfigOverride(
192
194
  config = ValidateStatefulSession(context, stateful_session, errors);
193
195
  }
194
196
  }
195
- return FilterConfig{OverrideConfigProtoName(), Json(std::move(config))};
197
+ return FilterConfig{OverrideConfigProtoName(),
198
+ Json::FromObject(std::move(config))};
196
199
  }
197
200
 
198
201
  const grpc_channel_filter* XdsHttpStatefulSessionFilter::channel_filter()
@@ -208,10 +211,11 @@ ChannelArgs XdsHttpStatefulSessionFilter::ModifyChannelArgs(
208
211
  absl::StatusOr<XdsHttpFilterImpl::ServiceConfigJsonEntry>
209
212
  XdsHttpStatefulSessionFilter::GenerateServiceConfig(
210
213
  const FilterConfig& hcm_filter_config,
211
- const FilterConfig* filter_config_override) const {
212
- Json config = filter_config_override != nullptr
213
- ? filter_config_override->config
214
- : hcm_filter_config.config;
214
+ const FilterConfig* filter_config_override,
215
+ absl::string_view /*filter_name*/) const {
216
+ const Json& config = filter_config_override != nullptr
217
+ ? filter_config_override->config
218
+ : hcm_filter_config.config;
215
219
  return ServiceConfigJsonEntry{"stateful_session", JsonDump(config)};
216
220
  }
217
221