bool evaluateFractionalPercent(envoy::type::v3::FractionalPercent percent, uint64_t random_value) {
if (field->is_repeated() || field->cpp_type() != Protobuf::FieldDescriptor::CPPTYPE_ENUM) {
enum_value_descriptor->options().GetExtension(envoy::annotations::disallowed_by_default_enum),
"threat model, are not supported by the security team, and are subject to breaking changes. Do "
void onField(const Protobuf::Message& message, const Protobuf::FieldDescriptor& field) override {
checkForDeprecatedNonRepeatedEnumValue(message, filename, &field, reflection, runtime_,
if ((field.is_repeated() && reflection->FieldSize(*reflectable_message, &field) == 0) ||
const auto& field_status = field.options().GetExtension(xds::annotations::v3::field_status);
const Protobuf::ReflectableMessage reflectable_message = createReflectableMessage(message);
void MessageUtil::validateDurationFields(const Protobuf::Message& message, bool recurse_into_any) {
absl::Status MessageUtil::unpackTo(const Protobuf::Any& any_message, Protobuf::Message& message) {
std::string MessageUtil::convertToStringForLogs(const Protobuf::Message& message, bool pretty_print,
return getJsonStringFromMessageOrError(message, pretty_print, always_print_primitive_fields);
Protobuf::Struct MessageUtil::keyValueStruct(const std::string& key, const std::string& value) {
Protobuf::Struct MessageUtil::keyValueStruct(const std::map<std::string, std::string>& fields) {
// To redact opaque types, namely `Any` and `TypedStruct`, we have to reify them to the concrete
// message types specified by their `type_url` before we can redact their contents. This is mostly
// unpacked. Note that we have to use reflection on the opaque type here, rather than downcasting
// to `Any` or `TypedStruct`, because any message we might be handling could have originated from
ENVOY_LOG_MISC(warn, "Could not reify {} with unknown type URL {}", opaque_type_name, type_url);
ENVOY_LOG_MISC(warn, "Could not unpack {} with type URL {}: {}", opaque_type_name, type_url,