grpc 1.56.2 → 1.57.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +29 -22
- data/include/grpc/event_engine/event_engine.h +22 -32
- data/include/grpc/impl/grpc_types.h +3 -0
- data/include/grpc/support/port_platform.h +29 -23
- data/src/core/ext/filters/client_channel/client_channel.cc +44 -8
- data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +5 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +21 -52
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +19 -7
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +25 -35
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +78 -132
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +38 -15
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +3 -5
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +22 -6
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +97 -71
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -16
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +56 -11
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +25 -0
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -32
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +4 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +20 -79
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -19
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -41
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -67
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +8 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +31 -74
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +7 -51
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +16 -87
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +16 -50
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -74
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -4
- data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +69 -59
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +7 -2
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +1 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +25 -13
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +366 -311
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +17 -1
- data/src/core/ext/filters/client_channel/retry_filter.cc +39 -2498
- data/src/core/ext/filters/client_channel/retry_filter.h +91 -1
- data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.cc +2052 -0
- data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.h +442 -0
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +38 -58
- data/src/core/ext/filters/client_channel/subchannel.h +3 -3
- data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -0
- data/src/core/ext/filters/rbac/rbac_filter.cc +40 -111
- data/src/core/ext/filters/rbac/rbac_filter.h +12 -30
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +162 -86
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +0 -6
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -4
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +131 -186
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +6569 -174
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +2278 -441
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -8
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +8 -4
- data/src/core/ext/transport/chttp2/transport/parsing.cc +15 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +2 -3
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -6
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +143 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +0 -39
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +13 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +35 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +17 -13
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +85 -20
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +26 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +45 -3
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +4 -3
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +21 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +30 -6
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +180 -0
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +558 -0
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +2710 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +30 -11
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +53 -24
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +30 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +110 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +41 -15
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +150 -27
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +93 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +88 -76
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +11 -12
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +0 -5
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +162 -160
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +129 -118
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +141 -135
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +19 -12
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +38 -30
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.c +402 -0
- data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.h +111 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +80 -74
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +63 -47
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +315 -293
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +29 -29
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +33 -30
- data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -13
- data/src/core/ext/xds/xds_client_grpc.cc +11 -6
- data/src/core/ext/xds/xds_client_grpc.h +16 -2
- data/src/core/ext/xds/xds_client_stats.h +10 -0
- data/src/core/ext/xds/xds_cluster.cc +26 -16
- data/src/core/ext/xds/xds_endpoint.cc +4 -7
- data/src/core/ext/xds/xds_health_status.cc +0 -17
- data/src/core/ext/xds/xds_health_status.h +5 -25
- data/src/core/ext/xds/xds_lb_policy_registry.cc +39 -0
- data/src/core/ext/xds/xds_route_config.cc +4 -0
- data/src/core/ext/xds/xds_transport_grpc.cc +1 -3
- data/src/core/lib/address_utils/parse_address.cc +63 -1
- data/src/core/lib/address_utils/parse_address.h +8 -0
- data/src/core/lib/address_utils/sockaddr_utils.cc +46 -1
- data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
- data/src/core/lib/channel/channel_args.cc +21 -10
- data/src/core/lib/channel/channel_args.h +3 -0
- data/src/core/lib/channel/connected_channel.cc +4 -1
- data/src/core/lib/channel/promise_based_filter.h +1 -0
- data/src/core/lib/debug/trace.cc +1 -4
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -1
- data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -1
- data/src/core/lib/event_engine/event_engine.cc +0 -12
- data/src/core/lib/event_engine/forkable.cc +47 -42
- data/src/core/lib/event_engine/handle_containers.h +0 -4
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -6
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -6
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +25 -11
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +3 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +8 -12
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +37 -27
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +4 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +42 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +6 -0
- data/src/core/lib/event_engine/posix_engine/timer.h +10 -37
- data/src/core/lib/event_engine/tcp_socket_utils.cc +67 -7
- data/src/core/lib/event_engine/tcp_socket_utils.h +3 -0
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +90 -37
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +32 -12
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +12 -21
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +8 -12
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +55 -54
- data/src/core/lib/event_engine/windows/windows_endpoint.h +15 -12
- data/src/core/lib/event_engine/windows/windows_engine.cc +2 -1
- data/src/core/lib/event_engine/windows/windows_engine.h +8 -12
- data/src/core/lib/experiments/config.cc +60 -22
- data/src/core/lib/experiments/config.h +20 -8
- data/src/core/lib/experiments/experiments.cc +278 -0
- data/src/core/lib/experiments/experiments.h +59 -1
- data/src/core/lib/gprpp/dual_ref_counted.h +9 -9
- data/src/core/lib/gprpp/fork.cc +8 -9
- data/src/core/lib/gprpp/fork.h +6 -5
- data/src/core/lib/gprpp/if_list.h +4530 -0
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/ref_counted.h +6 -6
- data/src/core/lib/gprpp/sorted_pack.h +3 -12
- data/src/core/lib/gprpp/status_helper.h +16 -15
- data/src/core/lib/gprpp/time.h +12 -0
- data/src/core/lib/gprpp/type_list.h +32 -0
- data/src/core/lib/http/httpcli.h +6 -9
- data/src/core/lib/iomgr/error.cc +32 -2
- data/src/core/lib/iomgr/error.h +9 -10
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -7
- data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
- data/src/core/lib/iomgr/exec_ctx.h +11 -0
- data/src/core/lib/iomgr/pollset.h +4 -5
- data/src/core/lib/iomgr/port.h +10 -0
- data/src/core/lib/iomgr/resolve_address.cc +13 -1
- data/src/core/lib/iomgr/resolve_address.h +17 -3
- data/src/core/lib/iomgr/sockaddr_posix.h +7 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -0
- data/src/core/lib/iomgr/socket_utils_posix.cc +2 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +6 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
- data/src/core/lib/iomgr/tcp_posix.cc +21 -4
- data/src/core/lib/iomgr/tcp_server_posix.cc +3 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -2
- data/src/core/lib/iomgr/tcp_windows.cc +1 -3
- data/src/core/lib/iomgr/vsock.cc +59 -0
- data/src/core/lib/iomgr/vsock.h +38 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -6
- data/src/core/lib/load_balancing/delegating_helper.h +115 -0
- data/src/core/lib/load_balancing/lb_policy.h +20 -0
- data/src/core/lib/load_balancing/subchannel_interface.h +6 -0
- data/src/core/lib/promise/party.h +1 -1
- data/src/core/lib/resolver/resolver_factory.h +3 -2
- data/src/core/lib/resolver/server_address.cc +9 -94
- data/src/core/lib/resolver/server_address.h +10 -64
- data/src/core/lib/resource_quota/memory_quota.h +1 -1
- data/src/core/lib/security/credentials/channel_creds_registry.h +51 -27
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +169 -9
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -1
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -1
- data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +30 -38
- data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -0
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -1
- data/src/core/lib/service_config/service_config_call_data.h +5 -0
- data/src/core/lib/slice/slice.h +16 -0
- data/src/core/lib/surface/call.cc +31 -29
- data/src/core/lib/surface/server.h +2 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata_batch.cc +7 -7
- data/src/core/lib/transport/metadata_batch.h +86 -48
- data/src/core/lib/transport/parsed_metadata.h +34 -20
- data/src/core/lib/transport/simple_slice_based_metadata.h +9 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +4 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -2
- data/src/core/tsi/ssl_transport_security.cc +28 -7
- data/src/ruby/bin/math_pb.rb +24 -18
- data/src/ruby/ext/grpc/extconf.rb +19 -18
- data/src/ruby/ext/grpc/rb_call.c +62 -39
- data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_channel.c +126 -49
- data/src/ruby/ext/grpc/rb_channel.h +1 -0
- data/src/ruby/ext/grpc/rb_channel_args.c +16 -2
- data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_compression_options.c +0 -1
- data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
- data/src/ruby/ext/grpc/rb_grpc.c +192 -30
- data/src/ruby/ext/grpc/rb_grpc.h +8 -2
- data/src/ruby/ext/grpc/rb_server.c +62 -45
- data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
- data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +25 -111
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +25 -2
- data/third_party/boringssl-with-bazel/err_data.c +552 -552
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +34 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +7 -8
- data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +19 -1
- data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +8 -1
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +28 -185
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +3 -7
- data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +49 -46
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +18 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +2809 -7417
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +27 -5
- data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +20 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +110 -72
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +4 -3
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +15 -14
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +13 -10
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +35 -12
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +3 -7
- data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/evp/print.c +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +34 -72
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +12 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +12 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +17 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +277 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +180 -404
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +24 -57
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +17 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +33 -71
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +18 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +15 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +9 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +24 -24
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +11 -27
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/hkdf.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +40 -26
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +21 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +38 -19
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +2 -29
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +55 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +33 -52
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +3 -8
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +198 -79
- data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +5 -4
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -8
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +19 -23
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +8 -5
- data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +6 -12
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +48 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fuchsia.c → ios.c} +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/{refcount_no_threads.c → rand_extra/trusty.c} +15 -19
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +41 -19
- data/third_party/boringssl-with-bazel/src/crypto/{refcount_c11.c → refcount.c} +11 -17
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +147 -72
- data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +0 -8
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +6 -35
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +5 -26
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +14 -18
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +54 -143
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +7 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +8 -12
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +19 -20
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -15
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +4 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +4 -119
- data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +207 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +5 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -116
- data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +0 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +5 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +0 -21
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +21 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +19 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +11 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -14
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +0 -61
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +127 -81
- data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +224 -209
- data/third_party/boringssl-with-bazel/src/include/openssl/target.h +154 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -29
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +4 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +3 -2
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +9 -65
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +20 -20
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -11
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +24 -18
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +37 -30
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +125 -26
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -3
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +691 -0
- data/third_party/upb/upb/collections/map.c +3 -3
- metadata +27 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +0 -42
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +0 -64
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +0 -177
- data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -68
- data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +0 -89
@@ -18,20 +18,22 @@
|
|
18
18
|
|
19
19
|
#include "src/core/ext/filters/rbac/rbac_filter.h"
|
20
20
|
|
21
|
-
#include <
|
21
|
+
#include <functional>
|
22
|
+
#include <memory>
|
22
23
|
#include <utility>
|
23
24
|
|
24
25
|
#include "absl/status/status.h"
|
25
26
|
|
26
27
|
#include <grpc/grpc_security.h>
|
27
|
-
#include <grpc/status.h>
|
28
|
-
#include <grpc/support/log.h>
|
29
28
|
|
30
29
|
#include "src/core/ext/filters/rbac/rbac_service_config_parser.h"
|
31
30
|
#include "src/core/lib/channel/channel_args.h"
|
31
|
+
#include "src/core/lib/channel/channel_stack.h"
|
32
|
+
#include "src/core/lib/channel/context.h"
|
32
33
|
#include "src/core/lib/config/core_configuration.h"
|
33
|
-
#include "src/core/lib/
|
34
|
-
#include "src/core/lib/
|
34
|
+
#include "src/core/lib/iomgr/error.h"
|
35
|
+
#include "src/core/lib/promise/context.h"
|
36
|
+
#include "src/core/lib/promise/promise.h"
|
35
37
|
#include "src/core/lib/security/authorization/authorization_engine.h"
|
36
38
|
#include "src/core/lib/security/authorization/grpc_authorization_engine.h"
|
37
39
|
#include "src/core/lib/security/context/security_context.h"
|
@@ -41,101 +43,34 @@
|
|
41
43
|
|
42
44
|
namespace grpc_core {
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
//
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
CallData* calld = static_cast<CallData*>(elem->call_data);
|
66
|
-
if (op->recv_initial_metadata) {
|
67
|
-
calld->recv_initial_metadata_ =
|
68
|
-
op->payload->recv_initial_metadata.recv_initial_metadata;
|
69
|
-
calld->original_recv_initial_metadata_ready_ =
|
70
|
-
op->payload->recv_initial_metadata.recv_initial_metadata_ready;
|
71
|
-
op->payload->recv_initial_metadata.recv_initial_metadata_ready =
|
72
|
-
&calld->recv_initial_metadata_ready_;
|
73
|
-
}
|
74
|
-
// Chain to the next filter.
|
75
|
-
grpc_call_next_op(elem, op);
|
76
|
-
}
|
77
|
-
|
78
|
-
RbacFilter::CallData::CallData(grpc_call_element* elem,
|
79
|
-
const grpc_call_element_args& args)
|
80
|
-
: call_context_(args.context) {
|
81
|
-
GRPC_CLOSURE_INIT(&recv_initial_metadata_ready_, RecvInitialMetadataReady,
|
82
|
-
elem, grpc_schedule_on_exec_ctx);
|
83
|
-
}
|
84
|
-
|
85
|
-
void RbacFilter::CallData::RecvInitialMetadataReady(void* user_data,
|
86
|
-
grpc_error_handle error) {
|
87
|
-
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
88
|
-
CallData* calld = static_cast<CallData*>(elem->call_data);
|
89
|
-
RbacFilter* filter = static_cast<RbacFilter*>(elem->channel_data);
|
90
|
-
if (error.ok()) {
|
91
|
-
// Fetch and apply the rbac policy from the service config.
|
92
|
-
auto* service_config_call_data = static_cast<ServiceConfigCallData*>(
|
93
|
-
calld->call_context_[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA].value);
|
94
|
-
auto* method_params = static_cast<RbacMethodParsedConfig*>(
|
95
|
-
service_config_call_data->GetMethodParsedConfig(
|
96
|
-
filter->service_config_parser_index_));
|
97
|
-
if (method_params == nullptr) {
|
98
|
-
error = GRPC_ERROR_CREATE("No RBAC policy found.");
|
99
|
-
} else {
|
100
|
-
RbacFilter* chand = static_cast<RbacFilter*>(elem->channel_data);
|
101
|
-
auto* authorization_engine =
|
102
|
-
method_params->authorization_engine(chand->index_);
|
103
|
-
if (authorization_engine
|
104
|
-
->Evaluate(EvaluateArgs(calld->recv_initial_metadata_,
|
105
|
-
&chand->per_channel_evaluate_args_))
|
106
|
-
.type == AuthorizationEngine::Decision::Type::kDeny) {
|
107
|
-
error = GRPC_ERROR_CREATE("Unauthorized RPC rejected");
|
108
|
-
}
|
109
|
-
}
|
110
|
-
if (!error.ok()) {
|
111
|
-
error = grpc_error_set_int(error, StatusIntProperty::kRpcStatus,
|
112
|
-
GRPC_STATUS_PERMISSION_DENIED);
|
46
|
+
ArenaPromise<ServerMetadataHandle> RbacFilter::MakeCallPromise(
|
47
|
+
CallArgs call_args, NextPromiseFactory next_promise_factory) {
|
48
|
+
// Fetch and apply the rbac policy from the service config.
|
49
|
+
auto* service_config_call_data = static_cast<ServiceConfigCallData*>(
|
50
|
+
GetContext<
|
51
|
+
grpc_call_context_element>()[GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA]
|
52
|
+
.value);
|
53
|
+
auto* method_params = static_cast<RbacMethodParsedConfig*>(
|
54
|
+
service_config_call_data->GetMethodParsedConfig(
|
55
|
+
service_config_parser_index_));
|
56
|
+
if (method_params == nullptr) {
|
57
|
+
return Immediate(ServerMetadataFromStatus(
|
58
|
+
absl::PermissionDeniedError("No RBAC policy found.")));
|
59
|
+
} else {
|
60
|
+
auto* authorization_engine = method_params->authorization_engine(index_);
|
61
|
+
if (authorization_engine
|
62
|
+
->Evaluate(EvaluateArgs(call_args.client_initial_metadata.get(),
|
63
|
+
&per_channel_evaluate_args_))
|
64
|
+
.type == AuthorizationEngine::Decision::Type::kDeny) {
|
65
|
+
return Immediate(ServerMetadataFromStatus(
|
66
|
+
absl::PermissionDeniedError("Unauthorized RPC rejected")));
|
113
67
|
}
|
114
68
|
}
|
115
|
-
|
116
|
-
calld->original_recv_initial_metadata_ready_ = nullptr;
|
117
|
-
Closure::Run(DEBUG_LOCATION, closure, error);
|
69
|
+
return next_promise_factory(std::move(call_args));
|
118
70
|
}
|
119
71
|
|
120
|
-
|
121
|
-
|
122
|
-
//
|
123
|
-
|
124
|
-
const grpc_channel_filter RbacFilter::kFilterVtable = {
|
125
|
-
RbacFilter::CallData::StartTransportStreamOpBatch,
|
126
|
-
nullptr,
|
127
|
-
grpc_channel_next_op,
|
128
|
-
sizeof(RbacFilter::CallData),
|
129
|
-
RbacFilter::CallData::Init,
|
130
|
-
grpc_call_stack_ignore_set_pollset_or_pollset_set,
|
131
|
-
RbacFilter::CallData::Destroy,
|
132
|
-
sizeof(RbacFilter),
|
133
|
-
RbacFilter::Init,
|
134
|
-
grpc_channel_stack_no_post_init,
|
135
|
-
RbacFilter::Destroy,
|
136
|
-
grpc_channel_next_get_info,
|
137
|
-
"rbac_filter",
|
138
|
-
};
|
72
|
+
const grpc_channel_filter RbacFilter::kFilterVtable =
|
73
|
+
MakePromiseBasedFilter<RbacFilter, FilterEndpoint::kServer>("rbac_filter");
|
139
74
|
|
140
75
|
RbacFilter::RbacFilter(size_t index,
|
141
76
|
EvaluateArgs::PerChannelArgs per_channel_evaluate_args)
|
@@ -143,29 +78,23 @@ RbacFilter::RbacFilter(size_t index,
|
|
143
78
|
service_config_parser_index_(RbacServiceConfigParser::ParserIndex()),
|
144
79
|
per_channel_evaluate_args_(std::move(per_channel_evaluate_args)) {}
|
145
80
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
auto* auth_context = args->channel_args.GetObject<grpc_auth_context>();
|
81
|
+
absl::StatusOr<RbacFilter> RbacFilter::Create(const ChannelArgs& args,
|
82
|
+
ChannelFilter::Args filter_args) {
|
83
|
+
auto* auth_context = args.GetObject<grpc_auth_context>();
|
150
84
|
if (auth_context == nullptr) {
|
151
85
|
return GRPC_ERROR_CREATE("No auth context found");
|
152
86
|
}
|
153
|
-
auto* transport = args
|
87
|
+
auto* transport = args.GetObject<grpc_transport>();
|
154
88
|
if (transport == nullptr) {
|
155
89
|
// This should never happen since the transport is always set on the server
|
156
90
|
// side.
|
157
91
|
return GRPC_ERROR_CREATE("No transport configured");
|
158
92
|
}
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
}
|
165
|
-
|
166
|
-
void RbacFilter::Destroy(grpc_channel_element* elem) {
|
167
|
-
auto* chand = static_cast<RbacFilter*>(elem->channel_data);
|
168
|
-
chand->~RbacFilter();
|
93
|
+
return RbacFilter(grpc_channel_stack_filter_instance_number(
|
94
|
+
filter_args.channel_stack(),
|
95
|
+
filter_args.uninitialized_channel_element()),
|
96
|
+
EvaluateArgs::PerChannelArgs(
|
97
|
+
auth_context, grpc_transport_get_endpoint(transport)));
|
169
98
|
}
|
170
99
|
|
171
100
|
void RbacFilterRegister(CoreConfiguration::Builder* builder) {
|
@@ -21,20 +21,20 @@
|
|
21
21
|
|
22
22
|
#include <stddef.h>
|
23
23
|
|
24
|
+
#include "absl/status/statusor.h"
|
25
|
+
|
26
|
+
#include "src/core/lib/channel/channel_args.h"
|
24
27
|
#include "src/core/lib/channel/channel_fwd.h"
|
25
|
-
#include "src/core/lib/channel/
|
26
|
-
#include "src/core/lib/
|
27
|
-
#include "src/core/lib/iomgr/closure.h"
|
28
|
-
#include "src/core/lib/iomgr/error.h"
|
28
|
+
#include "src/core/lib/channel/promise_based_filter.h"
|
29
|
+
#include "src/core/lib/promise/arena_promise.h"
|
29
30
|
#include "src/core/lib/security/authorization/evaluate_args.h"
|
30
|
-
#include "src/core/lib/transport/metadata_batch.h"
|
31
31
|
#include "src/core/lib/transport/transport.h"
|
32
32
|
|
33
33
|
namespace grpc_core {
|
34
34
|
|
35
35
|
// Filter used when xDS server config fetcher provides a configuration with an
|
36
36
|
// HTTP RBAC filter. Also serves as the type for channel data for the filter.
|
37
|
-
class RbacFilter {
|
37
|
+
class RbacFilter : public ChannelFilter {
|
38
38
|
public:
|
39
39
|
// This channel filter is intended to be used by connections on xDS enabled
|
40
40
|
// servers configured with RBAC. The RBAC filter fetches the RBAC policy from
|
@@ -42,34 +42,16 @@ class RbacFilter {
|
|
42
42
|
// and enforces the RBAC policy.
|
43
43
|
static const grpc_channel_filter kFilterVtable;
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
public:
|
48
|
-
static grpc_error_handle Init(grpc_call_element* elem,
|
49
|
-
const grpc_call_element_args* args);
|
50
|
-
static void Destroy(grpc_call_element* elem,
|
51
|
-
const grpc_call_final_info* /* final_info */,
|
52
|
-
grpc_closure* /* then_schedule_closure */);
|
53
|
-
static void StartTransportStreamOpBatch(grpc_call_element* elem,
|
54
|
-
grpc_transport_stream_op_batch* op);
|
55
|
-
|
56
|
-
private:
|
57
|
-
CallData(grpc_call_element* elem, const grpc_call_element_args& args);
|
58
|
-
static void RecvInitialMetadataReady(void* user_data,
|
59
|
-
grpc_error_handle error);
|
45
|
+
static absl::StatusOr<RbacFilter> Create(const ChannelArgs& args,
|
46
|
+
ChannelFilter::Args filter_args);
|
60
47
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
grpc_closure* original_recv_initial_metadata_ready_ = nullptr;
|
65
|
-
grpc_closure recv_initial_metadata_ready_;
|
66
|
-
};
|
48
|
+
// Construct a promise for one call.
|
49
|
+
ArenaPromise<ServerMetadataHandle> MakeCallPromise(
|
50
|
+
CallArgs call_args, NextPromiseFactory next_promise_factory) override;
|
67
51
|
|
52
|
+
private:
|
68
53
|
RbacFilter(size_t index,
|
69
54
|
EvaluateArgs::PerChannelArgs per_channel_evaluate_args);
|
70
|
-
static grpc_error_handle Init(grpc_channel_element* elem,
|
71
|
-
grpc_channel_element_args* args);
|
72
|
-
static void Destroy(grpc_channel_element* elem);
|
73
55
|
|
74
56
|
// The index of this filter instance among instances of the same filter.
|
75
57
|
size_t index_;
|
@@ -33,11 +33,13 @@
|
|
33
33
|
#include "absl/strings/str_join.h"
|
34
34
|
#include "absl/strings/str_split.h"
|
35
35
|
#include "absl/strings/string_view.h"
|
36
|
+
#include "absl/strings/strip.h"
|
36
37
|
#include "absl/types/optional.h"
|
37
38
|
|
38
39
|
#include <grpc/support/log.h>
|
39
40
|
#include <grpc/support/time.h>
|
40
41
|
|
42
|
+
#include "src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h"
|
41
43
|
#include "src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h"
|
42
44
|
#include "src/core/lib/channel/channel_stack.h"
|
43
45
|
#include "src/core/lib/channel/context.h"
|
@@ -83,35 +85,142 @@ StatefulSessionFilter::StatefulSessionFilter(ChannelFilter::Args filter_args)
|
|
83
85
|
|
84
86
|
namespace {
|
85
87
|
|
88
|
+
absl::string_view AllocateStringOnArena(
|
89
|
+
absl::string_view src1, absl::string_view src2 = absl::string_view()) {
|
90
|
+
if (src1.empty() && src2.empty()) {
|
91
|
+
return absl::string_view();
|
92
|
+
}
|
93
|
+
char* arena_allocated_value =
|
94
|
+
static_cast<char*>(GetContext<Arena>()->Alloc(src1.size() + src2.size()));
|
95
|
+
memcpy(arena_allocated_value, src1.data(), src1.size());
|
96
|
+
if (!src2.empty()) {
|
97
|
+
memcpy(arena_allocated_value + src1.size(), src2.data(), src2.size());
|
98
|
+
}
|
99
|
+
return absl::string_view(arena_allocated_value, src1.size() + src2.size());
|
100
|
+
}
|
101
|
+
|
86
102
|
// Adds the set-cookie header to the server initial metadata if needed.
|
87
103
|
void MaybeUpdateServerInitialMetadata(
|
88
104
|
const StatefulSessionMethodParsedConfig::CookieConfig* cookie_config,
|
89
|
-
absl::
|
90
|
-
ServerMetadata* server_initial_metadata) {
|
105
|
+
bool cluster_changed, absl::string_view host_override,
|
106
|
+
absl::string_view actual_cluster, ServerMetadata* server_initial_metadata) {
|
91
107
|
// Get peer string.
|
92
108
|
Slice* peer_string = server_initial_metadata->get_pointer(PeerString());
|
93
|
-
if (peer_string == nullptr)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
if (peer_string == nullptr) {
|
110
|
+
// No changes, keep the same set-cookie header.
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
if (host_override == peer_string->as_string_view() && !cluster_changed) {
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
std::string new_value(peer_string->as_string_view());
|
117
|
+
if (!actual_cluster.empty()) {
|
118
|
+
absl::StrAppend(&new_value, ";", actual_cluster);
|
119
|
+
}
|
120
|
+
std::vector<std::string> parts = {absl::StrCat(
|
121
|
+
*cookie_config->name, "=", absl::Base64Escape(new_value), "; HttpOnly")};
|
122
|
+
if (!cookie_config->path.empty()) {
|
123
|
+
parts.emplace_back(absl::StrCat("Path=", cookie_config->path));
|
124
|
+
}
|
125
|
+
if (cookie_config->ttl > Duration::Zero()) {
|
126
|
+
parts.emplace_back(
|
127
|
+
absl::StrCat("Max-Age=", cookie_config->ttl.as_timespec().tv_sec));
|
128
|
+
}
|
129
|
+
server_initial_metadata->Append(
|
130
|
+
"set-cookie", Slice::FromCopiedString(absl::StrJoin(parts, "; ")),
|
131
|
+
[](absl::string_view error, const Slice&) {
|
132
|
+
Crash(absl::StrCat("ERROR ADDING set-cookie METADATA: ", error));
|
133
|
+
});
|
134
|
+
}
|
135
|
+
|
136
|
+
// Returns an arena-allocated string containing the cluster name
|
137
|
+
// to use for this RPC, which will live long enough to use when modifying
|
138
|
+
// the server's initial metadata. If cluster_from_cookie is non-empty and
|
139
|
+
// points to a cluster present in the selected route, uses that; otherwise,
|
140
|
+
// uses the cluster selected by the XdsConfigSelector.
|
141
|
+
// Returns the empty string if cluster override cannot be used (i.e., the route
|
142
|
+
// uses a cluster specifier plugin).
|
143
|
+
absl::string_view GetClusterToUse(
|
144
|
+
absl::string_view cluster_from_cookie,
|
145
|
+
ServiceConfigCallData* service_config_call_data) {
|
146
|
+
// Get cluster assigned by the XdsConfigSelector.
|
147
|
+
auto cluster_attribute =
|
148
|
+
service_config_call_data->GetCallAttribute<XdsClusterAttribute>();
|
149
|
+
GPR_ASSERT(cluster_attribute != nullptr);
|
150
|
+
auto current_cluster = cluster_attribute->cluster();
|
151
|
+
static constexpr absl::string_view kClusterPrefix = "cluster:";
|
152
|
+
// If prefix is not "cluster:", then we can't use cluster override.
|
153
|
+
if (!absl::ConsumePrefix(¤t_cluster, kClusterPrefix)) {
|
154
|
+
return absl::string_view();
|
155
|
+
}
|
156
|
+
// No cluster in cookie, use the cluster from the attribute
|
157
|
+
if (cluster_from_cookie.empty()) {
|
158
|
+
return AllocateStringOnArena(current_cluster);
|
159
|
+
}
|
160
|
+
// Use cluster from the cookie if it is configured for the route.
|
161
|
+
auto route_data =
|
162
|
+
service_config_call_data->GetCallAttribute<XdsRouteStateAttribute>();
|
163
|
+
GPR_ASSERT(route_data != nullptr);
|
164
|
+
// Cookie cluster was not configured for route - use the one from the
|
165
|
+
// attribute
|
166
|
+
if (!route_data->HasClusterForRoute(cluster_from_cookie)) {
|
167
|
+
return AllocateStringOnArena(current_cluster);
|
168
|
+
}
|
169
|
+
auto arena_allocated_cluster =
|
170
|
+
AllocateStringOnArena(kClusterPrefix, cluster_from_cookie);
|
171
|
+
// Update the cluster name attribute with an arena allocated value.
|
172
|
+
cluster_attribute->set_cluster(arena_allocated_cluster);
|
173
|
+
return absl::StripPrefix(arena_allocated_cluster, kClusterPrefix);
|
174
|
+
}
|
175
|
+
|
176
|
+
std::string GetCookieValue(const ClientMetadataHandle& client_initial_metadata,
|
177
|
+
absl::string_view cookie_name) {
|
178
|
+
// Check to see if the cookie header is present.
|
179
|
+
std::string buffer;
|
180
|
+
auto header_value =
|
181
|
+
client_initial_metadata->GetStringValue("cookie", &buffer);
|
182
|
+
if (!header_value.has_value()) return "";
|
183
|
+
// Parse cookie header.
|
184
|
+
std::vector<absl::string_view> values;
|
185
|
+
for (absl::string_view cookie : absl::StrSplit(*header_value, "; ")) {
|
186
|
+
std::pair<absl::string_view, absl::string_view> kv =
|
187
|
+
absl::StrSplit(cookie, absl::MaxSplits('=', 1));
|
188
|
+
if (kv.first == cookie_name) values.push_back(kv.second);
|
112
189
|
}
|
190
|
+
if (values.empty()) return "";
|
191
|
+
// TODO(roth): Figure out the right behavior for multiple cookies.
|
192
|
+
// For now, just choose the first value.
|
193
|
+
std::string decoded;
|
194
|
+
if (absl::Base64Unescape(values.front(), &decoded)) {
|
195
|
+
return decoded;
|
196
|
+
}
|
197
|
+
return "";
|
113
198
|
}
|
114
199
|
|
200
|
+
bool IsConfiguredPath(absl::string_view configured_path,
|
201
|
+
const ClientMetadataHandle& client_initial_metadata) {
|
202
|
+
// No path configured meaning all paths match
|
203
|
+
if (configured_path.empty()) {
|
204
|
+
return true;
|
205
|
+
}
|
206
|
+
// Check to see if the configured path matches the request path.
|
207
|
+
Slice* path_slice = client_initial_metadata->get_pointer(HttpPathMetadata());
|
208
|
+
GPR_ASSERT(path_slice != nullptr);
|
209
|
+
absl::string_view path = path_slice->as_string_view();
|
210
|
+
// Matching criteria from
|
211
|
+
// https://www.rfc-editor.org/rfc/rfc6265#section-5.1.4.
|
212
|
+
// The cookie-path is a prefix of the request-path (and)
|
213
|
+
if (!absl::StartsWith(path, configured_path)) {
|
214
|
+
return false;
|
215
|
+
}
|
216
|
+
// One of
|
217
|
+
// 1. The cookie-path and the request-path are identical.
|
218
|
+
// 2. The last character of the cookie-path is %x2F ("/").
|
219
|
+
// 3. The first character of the request-path that is not included
|
220
|
+
// in the cookie-path is a %x2F ("/") character.
|
221
|
+
return path.length() == configured_path.length() ||
|
222
|
+
configured_path.back() == '/' || path[configured_path.length()] == '/';
|
223
|
+
}
|
115
224
|
} // namespace
|
116
225
|
|
117
226
|
// Construct a promise for one call.
|
@@ -129,90 +238,57 @@ ArenaPromise<ServerMetadataHandle> StatefulSessionFilter::MakeCallPromise(
|
|
129
238
|
GPR_ASSERT(method_params != nullptr);
|
130
239
|
auto* cookie_config = method_params->GetConfig(index_);
|
131
240
|
GPR_ASSERT(cookie_config != nullptr);
|
132
|
-
if (!cookie_config->name.has_value()
|
241
|
+
if (!cookie_config->name.has_value() ||
|
242
|
+
!IsConfiguredPath(cookie_config->path,
|
243
|
+
call_args.client_initial_metadata)) {
|
133
244
|
return next_promise_factory(std::move(call_args));
|
134
245
|
}
|
135
|
-
//
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
cookie_config->path.back() != '/' &&
|
147
|
-
path[cookie_config->path.size() + 1] != '/')) {
|
148
|
-
return next_promise_factory(std::move(call_args));
|
149
|
-
}
|
150
|
-
}
|
151
|
-
// Check to see if we have a host override cookie.
|
152
|
-
auto cookie_value = GetOverrideHostFromCookie(
|
153
|
-
call_args.client_initial_metadata, *cookie_config->name);
|
154
|
-
if (cookie_value.has_value()) {
|
155
|
-
if (GRPC_TRACE_FLAG_ENABLED(grpc_stateful_session_filter_trace)) {
|
156
|
-
gpr_log(GPR_INFO,
|
157
|
-
"chand=%p: stateful session filter found cookie %s value %s",
|
158
|
-
this, cookie_config->name->c_str(),
|
159
|
-
std::string(*cookie_value).c_str());
|
160
|
-
}
|
161
|
-
// We have a valid cookie, so add the call attribute to be used by the
|
162
|
-
// xds_override_host LB policy.
|
246
|
+
// Base64-decode cookie value.
|
247
|
+
std::string cookie_value =
|
248
|
+
GetCookieValue(call_args.client_initial_metadata, *cookie_config->name);
|
249
|
+
// Cookie format is "host;cluster"
|
250
|
+
std::pair<absl::string_view, absl::string_view> host_cluster =
|
251
|
+
absl::StrSplit(cookie_value, absl::MaxSplits(';', 1));
|
252
|
+
absl::string_view host_override;
|
253
|
+
// Set override host attribute. Allocate the string on the
|
254
|
+
// arena, so that it has the right lifetime.
|
255
|
+
if (!host_cluster.first.empty()) {
|
256
|
+
host_override = AllocateStringOnArena(host_cluster.first);
|
163
257
|
service_config_call_data->SetCallAttribute(
|
164
|
-
GetContext<Arena>()->New<XdsOverrideHostAttribute>(
|
258
|
+
GetContext<Arena>()->New<XdsOverrideHostAttribute>(host_override));
|
165
259
|
}
|
260
|
+
// Check if the cluster override is valid, and apply it if necessary.
|
261
|
+
// Note that cluster_name will point to an arena-allocated string
|
262
|
+
// that will still be alive when we see the server initial metadata.
|
263
|
+
// If the cluster name is empty, that means we cannot use a
|
264
|
+
// cluster override (i.e., the route uses a cluster specifier plugin).
|
265
|
+
absl::string_view cluster_name =
|
266
|
+
GetClusterToUse(host_cluster.second, service_config_call_data);
|
267
|
+
bool cluster_changed = cluster_name != host_cluster.second;
|
166
268
|
// Intercept server initial metadata.
|
167
269
|
call_args.server_initial_metadata->InterceptAndMap(
|
168
|
-
[cookie_config,
|
270
|
+
[cookie_config, cluster_changed, host_override,
|
271
|
+
cluster_name](ServerMetadataHandle md) {
|
169
272
|
// Add cookie to server initial metadata if needed.
|
170
|
-
MaybeUpdateServerInitialMetadata(cookie_config,
|
273
|
+
MaybeUpdateServerInitialMetadata(cookie_config, cluster_changed,
|
274
|
+
host_override, cluster_name, md.get());
|
171
275
|
return md;
|
172
276
|
});
|
173
277
|
return Map(next_promise_factory(std::move(call_args)),
|
174
|
-
[cookie_config,
|
278
|
+
[cookie_config, cluster_changed, host_override,
|
279
|
+
cluster_name](ServerMetadataHandle md) {
|
175
280
|
// If we got a Trailers-Only response, then add the
|
176
281
|
// cookie to the trailing metadata instead of the
|
177
282
|
// initial metadata.
|
178
283
|
if (md->get(GrpcTrailersOnly()).value_or(false)) {
|
179
|
-
MaybeUpdateServerInitialMetadata(
|
180
|
-
|
284
|
+
MaybeUpdateServerInitialMetadata(
|
285
|
+
cookie_config, cluster_changed, host_override,
|
286
|
+
cluster_name, md.get());
|
181
287
|
}
|
182
288
|
return md;
|
183
289
|
});
|
184
290
|
}
|
185
291
|
|
186
|
-
absl::optional<absl::string_view>
|
187
|
-
StatefulSessionFilter::GetOverrideHostFromCookie(
|
188
|
-
const ClientMetadataHandle& client_initial_metadata,
|
189
|
-
absl::string_view cookie_name) {
|
190
|
-
// Check to see if the cookie header is present.
|
191
|
-
std::string buffer;
|
192
|
-
auto header_value =
|
193
|
-
client_initial_metadata->GetStringValue("cookie", &buffer);
|
194
|
-
if (!header_value.has_value()) return absl::nullopt;
|
195
|
-
// Parse cookie header.
|
196
|
-
std::vector<absl::string_view> values;
|
197
|
-
for (absl::string_view cookie : absl::StrSplit(*header_value, "; ")) {
|
198
|
-
std::pair<absl::string_view, absl::string_view> kv =
|
199
|
-
absl::StrSplit(cookie, absl::MaxSplits('=', 1));
|
200
|
-
if (kv.first == cookie_name) values.push_back(kv.second);
|
201
|
-
}
|
202
|
-
if (values.empty()) return absl::nullopt;
|
203
|
-
// TODO(roth): Figure out the right behavior for multiple cookies.
|
204
|
-
// For now, just choose the first value.
|
205
|
-
absl::string_view value = values.front();
|
206
|
-
// Base64-decode it.
|
207
|
-
std::string decoded_value;
|
208
|
-
if (!absl::Base64Unescape(value, &decoded_value)) return absl::nullopt;
|
209
|
-
// Copy it into the arena, since it will need to persist until the LB pick.
|
210
|
-
char* arena_value =
|
211
|
-
static_cast<char*>(GetContext<Arena>()->Alloc(decoded_value.size()));
|
212
|
-
memcpy(arena_value, decoded_value.c_str(), decoded_value.size());
|
213
|
-
return absl::string_view(arena_value, decoded_value.size());
|
214
|
-
}
|
215
|
-
|
216
292
|
void StatefulSessionFilterRegister(CoreConfiguration::Builder* builder) {
|
217
293
|
StatefulSessionServiceConfigParser::Register(builder);
|
218
294
|
}
|
@@ -23,7 +23,6 @@
|
|
23
23
|
|
24
24
|
#include "absl/status/statusor.h"
|
25
25
|
#include "absl/strings/string_view.h"
|
26
|
-
#include "absl/types/optional.h"
|
27
26
|
|
28
27
|
#include "src/core/lib/channel/channel_args.h"
|
29
28
|
#include "src/core/lib/channel/channel_fwd.h"
|
@@ -65,11 +64,6 @@ class StatefulSessionFilter : public ChannelFilter {
|
|
65
64
|
|
66
65
|
private:
|
67
66
|
explicit StatefulSessionFilter(ChannelFilter::Args filter_args);
|
68
|
-
|
69
|
-
absl::optional<absl::string_view> GetOverrideHostFromCookie(
|
70
|
-
const ClientMetadataHandle& initial_metadata,
|
71
|
-
absl::string_view cookie_name);
|
72
|
-
|
73
67
|
// The relative index of instances of the same filter.
|
74
68
|
const size_t index_;
|
75
69
|
// Index of the service config parser.
|
@@ -71,6 +71,7 @@
|
|
71
71
|
#include "src/core/lib/iomgr/resolved_address.h"
|
72
72
|
#include "src/core/lib/iomgr/tcp_server.h"
|
73
73
|
#include "src/core/lib/iomgr/unix_sockets_posix.h"
|
74
|
+
#include "src/core/lib/iomgr/vsock.h"
|
74
75
|
#include "src/core/lib/resource_quota/memory_quota.h"
|
75
76
|
#include "src/core/lib/resource_quota/resource_quota.h"
|
76
77
|
#include "src/core/lib/security/credentials/credentials.h"
|
@@ -98,6 +99,7 @@ using ::grpc_event_engine::experimental::EventEngine;
|
|
98
99
|
|
99
100
|
const char kUnixUriPrefix[] = "unix:";
|
100
101
|
const char kUnixAbstractUriPrefix[] = "unix-abstract:";
|
102
|
+
const char kVSockUriPrefix[] = "vsock:";
|
101
103
|
|
102
104
|
class Chttp2ServerListener : public Server::ListenerInterface {
|
103
105
|
public:
|
@@ -244,13 +246,12 @@ class Chttp2ServerListener : public Server::ListenerInterface {
|
|
244
246
|
IncrementRefCount();
|
245
247
|
}
|
246
248
|
|
247
|
-
RefCountedPtr<Chttp2ServerListener> Ref()
|
249
|
+
GRPC_MUST_USE_RESULT RefCountedPtr<Chttp2ServerListener> Ref() {
|
248
250
|
IncrementRefCount();
|
249
251
|
return RefCountedPtr<Chttp2ServerListener>(this);
|
250
252
|
}
|
251
|
-
RefCountedPtr<Chttp2ServerListener> Ref(
|
252
|
-
|
253
|
-
GRPC_MUST_USE_RESULT {
|
253
|
+
GRPC_MUST_USE_RESULT RefCountedPtr<Chttp2ServerListener> Ref(
|
254
|
+
const DebugLocation& /* location */, const char* /* reason */) {
|
254
255
|
return Ref();
|
255
256
|
}
|
256
257
|
|
@@ -941,6 +942,8 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
|
|
941
942
|
kUnixAbstractUriPrefix)) {
|
942
943
|
resolved_or =
|
943
944
|
grpc_resolve_unix_abstract_domain_address(parsed_addr_unprefixed);
|
945
|
+
} else if (absl::ConsumePrefix(&parsed_addr_unprefixed, kVSockUriPrefix)) {
|
946
|
+
resolved_or = grpc_resolve_vsock_address(parsed_addr_unprefixed);
|
944
947
|
} else {
|
945
948
|
resolved_or =
|
946
949
|
GetDNSResolver()->LookupHostnameBlocking(parsed_addr, "https");
|