|
|
|
@ -19,9 +19,9 @@ |
|
|
|
|
#include "src/core/ext/xds/xds_http_rbac_filter.h" |
|
|
|
|
|
|
|
|
|
#include <stddef.h> |
|
|
|
|
#include <stdint.h> |
|
|
|
|
|
|
|
|
|
#include <algorithm> |
|
|
|
|
#include <cstdint> |
|
|
|
|
#include <string> |
|
|
|
|
#include <utility> |
|
|
|
|
|
|
|
|
@ -58,14 +58,16 @@ namespace { |
|
|
|
|
|
|
|
|
|
Json ParseRegexMatcherToJson( |
|
|
|
|
const envoy_type_matcher_v3_RegexMatcher* regex_matcher) { |
|
|
|
|
return Json::Object( |
|
|
|
|
{{"regex", UpbStringToStdString(envoy_type_matcher_v3_RegexMatcher_regex( |
|
|
|
|
regex_matcher))}}); |
|
|
|
|
return Json::FromObject( |
|
|
|
|
{{"regex", |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher)))}}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParseInt64RangeToJson(const envoy_type_v3_Int64Range* range) { |
|
|
|
|
return Json::Object{{"start", envoy_type_v3_Int64Range_start(range)}, |
|
|
|
|
{"end", envoy_type_v3_Int64Range_end(range)}}; |
|
|
|
|
return Json::FromObject( |
|
|
|
|
{{"start", Json::FromNumber(envoy_type_v3_Int64Range_start(range))}, |
|
|
|
|
{"end", Json::FromNumber(envoy_type_v3_Int64Range_end(range))}}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header, |
|
|
|
@ -80,13 +82,13 @@ Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header, |
|
|
|
|
} else if (absl::StartsWith(name, "grpc-")) { |
|
|
|
|
errors->AddError("'grpc-' prefixes not allowed in header"); |
|
|
|
|
} |
|
|
|
|
header_json.emplace("name", std::move(name)); |
|
|
|
|
header_json.emplace("name", Json::FromString(std::move(name))); |
|
|
|
|
} |
|
|
|
|
if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) { |
|
|
|
|
header_json.emplace( |
|
|
|
|
"exactMatch", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_exact_match(header))); |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_exact_match(header)))); |
|
|
|
|
} else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(header)) { |
|
|
|
|
header_json.emplace( |
|
|
|
|
"safeRegexMatch", |
|
|
|
@ -100,28 +102,30 @@ Json ParseHeaderMatcherToJson(const envoy_config_route_v3_HeaderMatcher* header, |
|
|
|
|
} else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) { |
|
|
|
|
header_json.emplace( |
|
|
|
|
"presentMatch", |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_present_match(header)); |
|
|
|
|
Json::FromBool( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_present_match(header))); |
|
|
|
|
} else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) { |
|
|
|
|
header_json.emplace( |
|
|
|
|
"prefixMatch", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_prefix_match(header))); |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_prefix_match(header)))); |
|
|
|
|
} else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) { |
|
|
|
|
header_json.emplace( |
|
|
|
|
"suffixMatch", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_suffix_match(header))); |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_suffix_match(header)))); |
|
|
|
|
} else if (envoy_config_route_v3_HeaderMatcher_has_contains_match(header)) { |
|
|
|
|
header_json.emplace( |
|
|
|
|
"containsMatch", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_contains_match(header))); |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_contains_match(header)))); |
|
|
|
|
} else { |
|
|
|
|
errors->AddError("invalid route header matcher specified"); |
|
|
|
|
} |
|
|
|
|
header_json.emplace("invertMatch", |
|
|
|
|
envoy_config_route_v3_HeaderMatcher_invert_match(header)); |
|
|
|
|
return header_json; |
|
|
|
|
header_json.emplace( |
|
|
|
|
"invertMatch", |
|
|
|
|
Json::FromBool(envoy_config_route_v3_HeaderMatcher_invert_match(header))); |
|
|
|
|
return Json::FromObject(std::move(header_json)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParseStringMatcherToJson( |
|
|
|
@ -130,30 +134,31 @@ Json ParseStringMatcherToJson( |
|
|
|
|
Json::Object json; |
|
|
|
|
if (envoy_type_matcher_v3_StringMatcher_has_exact(matcher)) { |
|
|
|
|
json.emplace("exact", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_type_matcher_v3_StringMatcher_exact(matcher))); |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_type_matcher_v3_StringMatcher_exact(matcher)))); |
|
|
|
|
} else if (envoy_type_matcher_v3_StringMatcher_has_prefix(matcher)) { |
|
|
|
|
json.emplace("prefix", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_type_matcher_v3_StringMatcher_prefix(matcher))); |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_type_matcher_v3_StringMatcher_prefix(matcher)))); |
|
|
|
|
} else if (envoy_type_matcher_v3_StringMatcher_has_suffix(matcher)) { |
|
|
|
|
json.emplace("suffix", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_type_matcher_v3_StringMatcher_suffix(matcher))); |
|
|
|
|
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", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_type_matcher_v3_StringMatcher_contains(matcher))); |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_type_matcher_v3_StringMatcher_contains(matcher)))); |
|
|
|
|
} else { |
|
|
|
|
errors->AddError("invalid match pattern"); |
|
|
|
|
} |
|
|
|
|
json.emplace("ignoreCase", |
|
|
|
|
envoy_type_matcher_v3_StringMatcher_ignore_case(matcher)); |
|
|
|
|
return json; |
|
|
|
|
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, |
|
|
|
@ -165,30 +170,32 @@ Json ParsePathMatcherToJson(const envoy_type_matcher_v3_PathMatcher* matcher, |
|
|
|
|
return Json(); |
|
|
|
|
} |
|
|
|
|
Json path_json = ParseStringMatcherToJson(path, errors); |
|
|
|
|
return Json::Object{{"path", std::move(path_json)}}; |
|
|
|
|
return Json::FromObject({{"path", std::move(path_json)}}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParseCidrRangeToJson(const envoy_config_core_v3_CidrRange* range) { |
|
|
|
|
Json::Object json; |
|
|
|
|
json.emplace("addressPrefix", |
|
|
|
|
UpbStringToStdString( |
|
|
|
|
envoy_config_core_v3_CidrRange_address_prefix(range))); |
|
|
|
|
Json::FromString(UpbStringToStdString( |
|
|
|
|
envoy_config_core_v3_CidrRange_address_prefix(range)))); |
|
|
|
|
const auto* prefix_len = envoy_config_core_v3_CidrRange_prefix_len(range); |
|
|
|
|
if (prefix_len != nullptr) { |
|
|
|
|
json.emplace("prefixLen", google_protobuf_UInt32Value_value(prefix_len)); |
|
|
|
|
json.emplace( |
|
|
|
|
"prefixLen", |
|
|
|
|
Json::FromNumber(google_protobuf_UInt32Value_value(prefix_len))); |
|
|
|
|
} |
|
|
|
|
return json; |
|
|
|
|
return Json::FromObject(std::move(json)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParseMetadataMatcherToJson( |
|
|
|
|
const envoy_type_matcher_v3_MetadataMatcher* metadata_matcher) { |
|
|
|
|
Json::Object json; |
|
|
|
|
// The fields "filter", "path" and "value" are irrelevant to gRPC as per
|
|
|
|
|
// https://github.com/grpc/proposal/blob/master/A41-xds-rbac.md and are not
|
|
|
|
|
// being parsed.
|
|
|
|
|
json.emplace("invert", |
|
|
|
|
envoy_type_matcher_v3_MetadataMatcher_invert(metadata_matcher)); |
|
|
|
|
return json; |
|
|
|
|
return Json::FromObject({ |
|
|
|
|
{"invert", Json::FromBool(envoy_type_matcher_v3_MetadataMatcher_invert( |
|
|
|
|
metadata_matcher))}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission, |
|
|
|
@ -208,7 +215,8 @@ Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission, |
|
|
|
|
Json permission_json = ParsePermissionToJson(rules[i], errors); |
|
|
|
|
rules_json.emplace_back(std::move(permission_json)); |
|
|
|
|
} |
|
|
|
|
return Json::Object({{"rules", std::move(rules_json)}}); |
|
|
|
|
return Json::FromObject( |
|
|
|
|
{{"rules", Json::FromArray(std::move(rules_json))}}); |
|
|
|
|
}; |
|
|
|
|
if (envoy_config_rbac_v3_Permission_has_and_rules(permission)) { |
|
|
|
|
ValidationErrors::ScopedField field(errors, ".and_permission"); |
|
|
|
@ -222,8 +230,8 @@ Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission, |
|
|
|
|
Json permission_set_json = parse_permission_set_to_json(or_rules); |
|
|
|
|
permission_json.emplace("orRules", std::move(permission_set_json)); |
|
|
|
|
} else if (envoy_config_rbac_v3_Permission_has_any(permission)) { |
|
|
|
|
permission_json.emplace("any", |
|
|
|
|
envoy_config_rbac_v3_Permission_any(permission)); |
|
|
|
|
permission_json.emplace( |
|
|
|
|
"any", Json::FromBool(envoy_config_rbac_v3_Permission_any(permission))); |
|
|
|
|
} else if (envoy_config_rbac_v3_Permission_has_header(permission)) { |
|
|
|
|
ValidationErrors::ScopedField field(errors, ".header"); |
|
|
|
|
Json header_json = ParseHeaderMatcherToJson( |
|
|
|
@ -242,7 +250,8 @@ Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission, |
|
|
|
|
} else if (envoy_config_rbac_v3_Permission_has_destination_port(permission)) { |
|
|
|
|
permission_json.emplace( |
|
|
|
|
"destinationPort", |
|
|
|
|
envoy_config_rbac_v3_Permission_destination_port(permission)); |
|
|
|
|
Json::FromNumber( |
|
|
|
|
envoy_config_rbac_v3_Permission_destination_port(permission))); |
|
|
|
|
} else if (envoy_config_rbac_v3_Permission_has_metadata(permission)) { |
|
|
|
|
permission_json.emplace( |
|
|
|
|
"metadata", ParseMetadataMatcherToJson( |
|
|
|
@ -263,7 +272,7 @@ Json ParsePermissionToJson(const envoy_config_rbac_v3_Permission* permission, |
|
|
|
|
} else { |
|
|
|
|
errors->AddError("invalid rule"); |
|
|
|
|
} |
|
|
|
|
return permission_json; |
|
|
|
|
return Json::FromObject(std::move(permission_json)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal, |
|
|
|
@ -283,7 +292,7 @@ Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal, |
|
|
|
|
Json principal_json = ParsePrincipalToJson(ids[i], errors); |
|
|
|
|
ids_json.emplace_back(std::move(principal_json)); |
|
|
|
|
} |
|
|
|
|
return Json::Object({{"ids", std::move(ids_json)}}); |
|
|
|
|
return Json::FromObject({{"ids", Json::FromArray(std::move(ids_json))}}); |
|
|
|
|
}; |
|
|
|
|
if (envoy_config_rbac_v3_Principal_has_and_ids(principal)) { |
|
|
|
|
ValidationErrors::ScopedField field(errors, ".and_ids"); |
|
|
|
@ -296,8 +305,8 @@ Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal, |
|
|
|
|
Json principal_set_json = parse_principal_set_to_json(or_rules); |
|
|
|
|
principal_json.emplace("orIds", std::move(principal_set_json)); |
|
|
|
|
} else if (envoy_config_rbac_v3_Principal_has_any(principal)) { |
|
|
|
|
principal_json.emplace("any", |
|
|
|
|
envoy_config_rbac_v3_Principal_any(principal)); |
|
|
|
|
principal_json.emplace( |
|
|
|
|
"any", Json::FromBool(envoy_config_rbac_v3_Principal_any(principal))); |
|
|
|
|
} else if (envoy_config_rbac_v3_Principal_has_authenticated(principal)) { |
|
|
|
|
Json::Object authenticated_json; |
|
|
|
|
const auto* principal_name = |
|
|
|
@ -310,7 +319,8 @@ Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal, |
|
|
|
|
ParseStringMatcherToJson(principal_name, errors); |
|
|
|
|
authenticated_json["principalName"] = std::move(principal_name_json); |
|
|
|
|
} |
|
|
|
|
principal_json["authenticated"] = std::move(authenticated_json); |
|
|
|
|
principal_json["authenticated"] = |
|
|
|
|
Json::FromObject(std::move(authenticated_json)); |
|
|
|
|
} else if (envoy_config_rbac_v3_Principal_has_source_ip(principal)) { |
|
|
|
|
principal_json.emplace( |
|
|
|
|
"sourceIp", ParseCidrRangeToJson( |
|
|
|
@ -346,7 +356,7 @@ Json ParsePrincipalToJson(const envoy_config_rbac_v3_Principal* principal, |
|
|
|
|
} else { |
|
|
|
|
errors->AddError("invalid rule"); |
|
|
|
|
} |
|
|
|
|
return principal_json; |
|
|
|
|
return Json::FromObject(std::move(principal_json)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParsePolicyToJson(const envoy_config_rbac_v3_Policy* policy, |
|
|
|
@ -362,7 +372,8 @@ Json ParsePolicyToJson(const envoy_config_rbac_v3_Policy* policy, |
|
|
|
|
Json permission_json = ParsePermissionToJson(permissions[i], errors); |
|
|
|
|
permissions_json.emplace_back(std::move(permission_json)); |
|
|
|
|
} |
|
|
|
|
policy_json.emplace("permissions", std::move(permissions_json)); |
|
|
|
|
policy_json.emplace("permissions", |
|
|
|
|
Json::FromArray(std::move(permissions_json))); |
|
|
|
|
Json::Array principals_json; |
|
|
|
|
const envoy_config_rbac_v3_Principal* const* principals = |
|
|
|
|
envoy_config_rbac_v3_Policy_principals(policy, &size); |
|
|
|
@ -372,7 +383,8 @@ Json ParsePolicyToJson(const envoy_config_rbac_v3_Policy* policy, |
|
|
|
|
Json principal_json = ParsePrincipalToJson(principals[i], errors); |
|
|
|
|
principals_json.emplace_back(std::move(principal_json)); |
|
|
|
|
} |
|
|
|
|
policy_json.emplace("principals", std::move(principals_json)); |
|
|
|
|
policy_json.emplace("principals", |
|
|
|
|
Json::FromArray(std::move(principals_json))); |
|
|
|
|
if (envoy_config_rbac_v3_Policy_has_condition(policy)) { |
|
|
|
|
ValidationErrors::ScopedField field(errors, ".condition"); |
|
|
|
|
errors->AddError("condition not supported"); |
|
|
|
@ -381,7 +393,7 @@ Json ParsePolicyToJson(const envoy_config_rbac_v3_Policy* policy, |
|
|
|
|
ValidationErrors::ScopedField field(errors, ".checked_condition"); |
|
|
|
|
errors->AddError("checked condition not supported"); |
|
|
|
|
} |
|
|
|
|
return policy_json; |
|
|
|
|
return Json::FromObject(std::move(policy_json)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParseAuditLoggerConfigsToJson( |
|
|
|
@ -403,7 +415,7 @@ Json ParseAuditLoggerConfigsToJson( |
|
|
|
|
logger_configs_json.emplace_back(registry.ConvertXdsAuditLoggerConfig( |
|
|
|
|
context, logger_configs[i], errors)); |
|
|
|
|
} |
|
|
|
|
return logger_configs_json; |
|
|
|
|
return Json::FromArray(logger_configs_json); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Json ParseHttpRbacToJson(const XdsResourceType::DecodeContext& context, |
|
|
|
@ -416,10 +428,11 @@ Json ParseHttpRbacToJson(const XdsResourceType::DecodeContext& context, |
|
|
|
|
int action = envoy_config_rbac_v3_RBAC_action(rules); |
|
|
|
|
// Treat Log action as RBAC being absent
|
|
|
|
|
if (action == envoy_config_rbac_v3_RBAC_LOG) { |
|
|
|
|
return rbac_json; |
|
|
|
|
return Json::FromObject({}); |
|
|
|
|
} |
|
|
|
|
Json::Object inner_rbac_json; |
|
|
|
|
inner_rbac_json.emplace("action", envoy_config_rbac_v3_RBAC_action(rules)); |
|
|
|
|
inner_rbac_json.emplace( |
|
|
|
|
"action", Json::FromNumber(envoy_config_rbac_v3_RBAC_action(rules))); |
|
|
|
|
if (envoy_config_rbac_v3_RBAC_policies_size(rules) != 0) { |
|
|
|
|
Json::Object policies_object; |
|
|
|
|
size_t iter = kUpb_Map_Begin; |
|
|
|
@ -436,7 +449,8 @@ Json ParseHttpRbacToJson(const XdsResourceType::DecodeContext& context, |
|
|
|
|
envoy_config_rbac_v3_RBAC_PoliciesEntry_value(entry), errors); |
|
|
|
|
policies_object.emplace(std::string(key), std::move(policy)); |
|
|
|
|
} |
|
|
|
|
inner_rbac_json.emplace("policies", std::move(policies_object)); |
|
|
|
|
inner_rbac_json.emplace("policies", |
|
|
|
|
Json::FromObject(std::move(policies_object))); |
|
|
|
|
} |
|
|
|
|
// Flatten the nested messages defined in rbac.proto
|
|
|
|
|
if (envoy_config_rbac_v3_RBAC_has_audit_logging_options(rules)) { |
|
|
|
@ -451,7 +465,8 @@ Json ParseHttpRbacToJson(const XdsResourceType::DecodeContext& context, |
|
|
|
|
case envoy_config_rbac_v3_RBAC_AuditLoggingOptions_ON_DENY: |
|
|
|
|
case envoy_config_rbac_v3_RBAC_AuditLoggingOptions_ON_ALLOW: |
|
|
|
|
case envoy_config_rbac_v3_RBAC_AuditLoggingOptions_ON_DENY_AND_ALLOW: |
|
|
|
|
inner_rbac_json.emplace("audit_condition", audit_condition); |
|
|
|
|
inner_rbac_json.emplace("audit_condition", |
|
|
|
|
Json::FromNumber(audit_condition)); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
ValidationErrors::ScopedField field(errors, ".audit_condition"); |
|
|
|
@ -464,9 +479,9 @@ Json ParseHttpRbacToJson(const XdsResourceType::DecodeContext& context, |
|
|
|
|
context, audit_logging_options, errors)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
rbac_json.emplace("rules", std::move(inner_rbac_json)); |
|
|
|
|
rbac_json.emplace("rules", Json::FromObject(std::move(inner_rbac_json))); |
|
|
|
|
} |
|
|
|
|
return rbac_json; |
|
|
|
|
return Json::FromObject(std::move(rbac_json)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
@ -526,7 +541,7 @@ XdsHttpRbacFilter::GenerateFilterConfigOverride( |
|
|
|
|
const auto* rbac = |
|
|
|
|
envoy_extensions_filters_http_rbac_v3_RBACPerRoute_rbac(rbac_per_route); |
|
|
|
|
if (rbac == nullptr) { |
|
|
|
|
rbac_json = Json::Object(); |
|
|
|
|
rbac_json = Json::FromObject({}); |
|
|
|
|
} else { |
|
|
|
|
ValidationErrors::ScopedField field(errors, ".rbac"); |
|
|
|
|
rbac_json = ParseHttpRbacToJson(context, rbac, errors); |
|
|
|
@ -548,13 +563,15 @@ XdsHttpRbacFilter::GenerateServiceConfig( |
|
|
|
|
const FilterConfig& hcm_filter_config, |
|
|
|
|
const FilterConfig* filter_config_override, |
|
|
|
|
absl::string_view filter_name) const { |
|
|
|
|
Json policy_json = filter_config_override != nullptr |
|
|
|
|
? filter_config_override->config |
|
|
|
|
: hcm_filter_config.config; |
|
|
|
|
const Json& policy_json = filter_config_override != nullptr |
|
|
|
|
? filter_config_override->config |
|
|
|
|
: hcm_filter_config.config; |
|
|
|
|
auto json_object = policy_json.object(); |
|
|
|
|
json_object.emplace("filter_name", std::string(filter_name)); |
|
|
|
|
json_object.emplace("filter_name", |
|
|
|
|
Json::FromString(std::string(filter_name))); |
|
|
|
|
// The policy JSON may be empty other than the filter name, that's allowed.
|
|
|
|
|
return ServiceConfigJsonEntry{"rbacPolicy", JsonDump(Json(json_object))}; |
|
|
|
|
return ServiceConfigJsonEntry{"rbacPolicy", |
|
|
|
|
JsonDump(Json::FromObject(json_object))}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} // namespace grpc_core
|
|
|
|
|