Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync c-core 1.68.1 #290

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gRPC-C++.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-C++'
# TODO (mxyan): use version that match gRPC version when pod is stabilized
version = '1.68.0'
version = '1.68.1'
s.version = version
s.summary = 'gRPC C++ library'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC-Core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC-Core'
version = '1.68.0'
version = '1.68.1'
s.version = version
s.summary = 'Core cross-platform gRPC library, written in C'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC-ProtoRPC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC-ProtoRPC'
version = '1.68.0'
version = '1.68.1'
s.version = version
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC-RxLibrary.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC-RxLibrary'
version = '1.68.0'
version = '1.68.1'
s.version = version
s.summary = 'Reactive Extensions library for iOS/OSX.'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC'
version = '1.68.0'
version = '1.68.1'
s.version = version
s.summary = 'gRPC client library for iOS/OSX'
s.homepage = 'https://grpc.io'
Expand Down
4 changes: 2 additions & 2 deletions include/grpcpp/version_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#define GRPC_CPP_VERSION_MAJOR 1
#define GRPC_CPP_VERSION_MINOR 68
#define GRPC_CPP_VERSION_PATCH 0
#define GRPC_CPP_VERSION_PATCH 1
#define GRPC_CPP_VERSION_TAG ""
#define GRPC_CPP_VERSION_STRING "1.68.0"
#define GRPC_CPP_VERSION_STRING "1.68.1"

#endif // GRPCPP_VERSION_INFO_H
12 changes: 10 additions & 2 deletions src/core/ext/filters/rbac/rbac_service_config_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,13 @@ void RbacConfig::RbacPolicy::Rules::Policy::HeaderMatch::JsonPostLoad(
range_match->end, invert_match));
return;
}
auto string_match = LoadJsonObjectField<StringMatch>(
json.object(), args, "stringMatch", errors, /*required=*/false);
if (string_match.has_value()) {
matcher = HeaderMatcher::CreateFromStringMatcher(
name, std::move(string_match->matcher), invert_match);
return;
}
if (errors->size() == original_error_size) {
errors->AddError("no valid matcher found");
}
Expand Down Expand Up @@ -390,7 +397,8 @@ void RbacConfig::RbacPolicy::Rules::Policy::StringMatch::JsonPostLoad(
field_name, errors,
/*required=*/false);
if (match.has_value()) {
set_string_matcher(StringMatcher::Create(type, *match, ignore_case));
set_string_matcher(
StringMatcher::Create(type, *match, /*case_sensitive=*/!ignore_case));
return true;
}
return false;
Expand All @@ -406,7 +414,7 @@ void RbacConfig::RbacPolicy::Rules::Policy::StringMatch::JsonPostLoad(
/*required=*/false);
if (regex_match.has_value()) {
set_string_matcher(StringMatcher::Create(StringMatcher::Type::kSafeRegex,
regex_match->regex, ignore_case));
regex_match->regex));
return;
}
if (errors->size() == original_error_size) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/surface/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>

const char* grpc_version_string(void) { return "44.1.0"; }
const char* grpc_version_string(void) { return "44.1.1"; }

const char* grpc_g_stands_for(void) { return "groovy"; }
7 changes: 7 additions & 0 deletions src/core/util/matchers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ absl::StatusOr<HeaderMatcher> HeaderMatcher::Create(
}
}

HeaderMatcher HeaderMatcher::CreateFromStringMatcher(absl::string_view name,
StringMatcher matcher,
bool invert_match) {
HeaderMatcher::Type type = static_cast<HeaderMatcher::Type>(matcher.type());
return HeaderMatcher(name, type, std::move(matcher), invert_match);
}

HeaderMatcher::HeaderMatcher(absl::string_view name, Type type,
StringMatcher string_matcher, bool invert_match)
: name_(name),
Expand Down
5 changes: 5 additions & 0 deletions src/core/util/matchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ class HeaderMatcher {
bool invert_match = false,
bool case_sensitive = true);

// Creates a HeaderMatcher from an existing StringMatcher instance.
static HeaderMatcher CreateFromStringMatcher(absl::string_view name,
StringMatcher matcher,
bool invert_match);

HeaderMatcher() = default;
HeaderMatcher(const HeaderMatcher& other);
HeaderMatcher& operator=(const HeaderMatcher& other);
Expand Down
71 changes: 38 additions & 33 deletions src/core/xds/grpc/xds_http_rbac_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,39 @@ Json ParseInt64RangeToJson(const envoy_type_v3_Int64Range* range) {
{"end", Json::FromNumber(envoy_type_v3_Int64Range_end(range))}});
}

Json ParseStringMatcherToJson(
const envoy_type_matcher_v3_StringMatcher* matcher,
ValidationErrors* errors) {
Json::Object json;
if (envoy_type_matcher_v3_StringMatcher_has_exact(matcher)) {
json.emplace("exact",
Json::FromString(UpbStringToStdString(
envoy_type_matcher_v3_StringMatcher_exact(matcher))));
} else if (envoy_type_matcher_v3_StringMatcher_has_prefix(matcher)) {
json.emplace("prefix",
Json::FromString(UpbStringToStdString(
envoy_type_matcher_v3_StringMatcher_prefix(matcher))));
} else if (envoy_type_matcher_v3_StringMatcher_has_suffix(matcher)) {
json.emplace("suffix",
Json::FromString(UpbStringToStdString(
envoy_type_matcher_v3_StringMatcher_suffix(matcher))));
} else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(matcher)) {
json.emplace("safeRegex",
ParseRegexMatcherToJson(
envoy_type_matcher_v3_StringMatcher_safe_regex(matcher)));
} else if (envoy_type_matcher_v3_StringMatcher_has_contains(matcher)) {
json.emplace("contains",
Json::FromString(UpbStringToStdString(
envoy_type_matcher_v3_StringMatcher_contains(matcher))));
} else {
errors->AddError("invalid match pattern");
}
json.emplace(
"ignoreCase",
Json::FromBool(envoy_type_matcher_v3_StringMatcher_ignore_case(matcher)));
return Json::FromObject(std::move(json));
}

Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header,
ValidationErrors* errors) {
Json::Object header_json;
Expand Down Expand Up @@ -130,6 +163,11 @@ Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header,
"containsMatch",
Json::FromString(UpbStringToStdString(
envoy_config_route_v3_HeaderMatcher_contains_match(header))));
} else if (envoy_config_route_v3_HeaderMatcher_has_string_match(header)) {
header_json.emplace(
"stringMatch",
ParseStringMatcherToJson(
envoy_config_route_v3_HeaderMatcher_string_match(header), errors));
} else {
errors->AddError("invalid route header matcher specified");
}
Expand All @@ -139,39 +177,6 @@ Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header,
return Json::FromObject(std::move(header_json));
}

Json ParseStringMatcherToJson(
const envoy_type_matcher_v3_StringMatcher* matcher,
ValidationErrors* errors) {
Json::Object json;
if (envoy_type_matcher_v3_StringMatcher_has_exact(matcher)) {
json.emplace("exact",
Json::FromString(UpbStringToStdString(
envoy_type_matcher_v3_StringMatcher_exact(matcher))));
} else if (envoy_type_matcher_v3_StringMatcher_has_prefix(matcher)) {
json.emplace("prefix",
Json::FromString(UpbStringToStdString(
envoy_type_matcher_v3_StringMatcher_prefix(matcher))));
} else if (envoy_type_matcher_v3_StringMatcher_has_suffix(matcher)) {
json.emplace("suffix",
Json::FromString(UpbStringToStdString(
envoy_type_matcher_v3_StringMatcher_suffix(matcher))));
} else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(matcher)) {
json.emplace("safeRegex",
ParseRegexMatcherToJson(
envoy_type_matcher_v3_StringMatcher_safe_regex(matcher)));
} else if (envoy_type_matcher_v3_StringMatcher_has_contains(matcher)) {
json.emplace("contains",
Json::FromString(UpbStringToStdString(
envoy_type_matcher_v3_StringMatcher_contains(matcher))));
} else {
errors->AddError("invalid match pattern");
}
json.emplace(
"ignoreCase",
Json::FromBool(envoy_type_matcher_v3_StringMatcher_ignore_case(matcher)));
return Json::FromObject(std::move(json));
}

Json ParsePathMatcherToJson(const envoy_type_matcher_v3_PathMatcher* matcher,
ValidationErrors* errors) {
ValidationErrors::ScopedField field(errors, ".path");
Expand Down
2 changes: 1 addition & 1 deletion src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Pod::Spec.new do |s|
# exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
# before them.
s.name = '!ProtoCompiler-gRPCCppPlugin'
v = '1.68.0'
v = '1.68.1'
s.version = v
s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.'
s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion src/objective-c/!ProtoCompiler-gRPCPlugin.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Pod::Spec.new do |s|
# exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
# before them.
s.name = '!ProtoCompiler-gRPCPlugin'
v = '1.68.0'
v = '1.68.1'
s.version = v
s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.'
s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion src/objective-c/GRPCClient/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
// instead. This file can be regenerated from the template by running
// `tools/buildgen/generate_projects.sh`.

#define GRPC_OBJC_VERSION_STRING @"1.68.0"
#define GRPC_OBJC_VERSION_STRING @"1.68.1"