Skip to content

Commit

Permalink
deps: update abseil and cel-cpp (envoyproxy#31456)
Browse files Browse the repository at this point in the history
Commit Message: Update CEL CPP to latest, and abseil to 9/18/23. Abseil seems coupled with protobuf, so we'll have to update them together later.
Additional Description:
Risk Level: low
Testing: regression
Docs Changes: none
Release Notes: none

Fix envoyproxy#29731
Fix envoyproxy#27607
  • Loading branch information
kyessenov authored Jan 10, 2024
1 parent 914ab6a commit bd1dca3
Show file tree
Hide file tree
Showing 37 changed files with 266 additions and 179 deletions.
223 changes: 65 additions & 158 deletions bazel/cel-cpp.patch
Original file line number Diff line number Diff line change
@@ -1,168 +1,75 @@
diff --git a/base/memory_manager.cc b/base/memory_manager.cc
index 1b7b355..4c7810c 100644
--- a/base/memory_manager.cc
+++ b/base/memory_manager.cc
@@ -234,7 +234,7 @@ class GlobalMemoryManager final : public MemoryManager {
void* Allocate(size_t size, size_t align) override {
static_cast<void>(size);
static_cast<void>(align);
- ABSL_INTERNAL_UNREACHABLE;
+ ABSL_UNREACHABLE();
return nullptr;
}
diff --git a/eval/public/cel_value.cc b/eval/public/cel_value.cc
index 6aeff6d..c43864c 100644
--- a/eval/public/cel_value.cc
+++ b/eval/public/cel_value.cc
@@ -107,7 +107,7 @@ struct DebugStringVisitor {

@@ -242,7 +242,7 @@ class GlobalMemoryManager final : public MemoryManager {
void OwnDestructor(void* pointer, void (*destructor)(void*)) override {
static_cast<void>(pointer);
static_cast<void>(destructor);
- ABSL_INTERNAL_UNREACHABLE;
+ ABSL_UNREACHABLE();
}
};
} // namespace

diff --git a/eval/eval/evaluator_stack.h b/eval/eval/evaluator_stack.h
index 1ecab27..9df65d7 100644
--- a/eval/eval/evaluator_stack.h
+++ b/eval/eval/evaluator_stack.h
@@ -5,6 +5,7 @@
#include <utility>
#include <vector>
-const absl::string_view kPayloadUrlMissingAttributePath =
+ABSL_CONST_INIT const absl::string_view kPayloadUrlMissingAttributePath =
cel::runtime_internal::kPayloadUrlMissingAttributePath;

+#include "absl/log/log.h"
#include "absl/types/span.h"
#include "eval/eval/attribute_trail.h"
#include "eval/public/cel_value.h"
diff --git a/eval/public/cel_expr_builder_factory.h b/eval/public/cel_expr_builder_factory.h
index 7321e29..0d0d5e6 100644
--- a/eval/public/cel_expr_builder_factory.h
+++ b/eval/public/cel_expr_builder_factory.h
@@ -1,6 +1,7 @@
#ifndef THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_CEL_EXPR_BUILDER_FACTORY_H_
#define THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_CEL_EXPR_BUILDER_FACTORY_H_
CelValue CelValue::CreateDuration(absl::Duration value) {
diff --git a/internal/strings.cc b/internal/strings.cc
index dc5a118..24457ab 100644
--- a/internal/strings.cc
+++ b/internal/strings.cc
@@ -53,12 +53,12 @@ bool CheckForClosingString(absl::string_view source,
if (closing_str.empty()) return true;

+#include "absl/log/log.h"
#include "google/protobuf/descriptor.h"
#include "eval/public/cel_expression.h"
#include "eval/public/cel_options.h"
diff --git a/eval/public/cel_value.h b/eval/public/cel_value.h
index b2d13f8..73e1909 100644
--- a/eval/public/cel_value.h
+++ b/eval/public/cel_value.h
@@ -25,7 +25,6 @@
#include "absl/base/attributes.h"
#include "absl/base/macros.h"
#include "absl/base/optimization.h"
-#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@@ -481,8 +480,8 @@ class CelValue {
}
const char* p = source.data();
- const char* end = source.end();
+ const char* end = p + source.size();

// Crashes with a null pointer error.
- static void CrashNullPointer(Type type) ABSL_ATTRIBUTE_COLD {
- LOG(FATAL) << "Null pointer supplied for " << TypeName(type); // Crash ok
+ static void CrashNullPointer(Type) ABSL_ATTRIBUTE_COLD {
+ ABSL_ASSERT(false);
}
bool is_closed = false;
while (p + closing_str.length() <= end) {
if (*p != '\\') {
- size_t cur_pos = p - source.begin();
+ size_t cur_pos = p - source.data();
bool is_closing =
absl::StartsWith(absl::ClippedSubstr(source, cur_pos), closing_str);
if (is_closing && p + closing_str.length() < end) {
@@ -132,7 +132,7 @@ bool UnescapeInternal(absl::string_view source, absl::string_view closing_str,
dest->reserve(source.size());

// Null pointer checker for pointer-based types.
@@ -493,11 +492,9 @@ class CelValue {
}
const char* p = source.data();
- const char* end = source.end();
+ const char* end = p + source.size();
const char* last_byte = end - 1;

// Crashes with a type mismatch error.
- static void CrashTypeMismatch(Type requested_type,
- Type actual_type) ABSL_ATTRIBUTE_COLD {
- LOG(FATAL) << "Type mismatch" // Crash ok
- << ": expected " << TypeName(requested_type) // Crash ok
- << ", encountered " << TypeName(actual_type); // Crash ok
+ static void CrashTypeMismatch(Type,
+ Type) ABSL_ATTRIBUTE_COLD {
+ ABSL_ASSERT(false);
while (p < end) {
@@ -446,7 +446,9 @@ std::string EscapeInternal(absl::string_view src, bool escape_all_bytes,
// byte.
dest.reserve(src.size() * 4);
bool last_hex_escape = false; // true if last output char was \xNN.
- for (const char* p = src.begin(); p < src.end(); ++p) {
+ const char* p = src.data();
+ const char* end = p + src.size();
+ for (; p < end; ++p) {
unsigned char c = static_cast<unsigned char>(*p);
bool is_hex_escape = false;
switch (c) {
@@ -552,7 +554,9 @@ std::string EscapeString(absl::string_view str) {
std::string EscapeBytes(absl::string_view str, bool escape_all_bytes,
char escape_quote_char) {
std::string escaped_bytes;
- for (const char* p = str.begin(); p < str.end(); ++p) {
+ const char* p = str.data();
+ const char* end = p + str.size();
+ for (; p < end; ++p) {
unsigned char c = *p;
if (escape_all_bytes || !absl::ascii_isprint(c)) {
escaped_bytes += "\\x";
diff --git a/tools/flatbuffers_backed_impl.cc b/tools/flatbuffers_backed_impl.cc
index 10c0b1c..45ba72f 100644
--- a/tools/flatbuffers_backed_impl.cc
+++ b/tools/flatbuffers_backed_impl.cc
@@ -130,6 +130,7 @@ class ObjectStringIndexedMapImpl : public CelMap {
return absl::nullopt;
}

// Gets value of type specified
diff --git a/eval/public/portable_cel_expr_builder_factory.cc b/eval/public/portable_cel_expr_builder_factory.cc
index 80ac45c..7dceb93 100644
--- a/eval/public/portable_cel_expr_builder_factory.cc
+++ b/eval/public/portable_cel_expr_builder_factory.cc
@@ -20,6 +20,7 @@
#include <string>
#include <utility>

+#include "absl/log/log.h"
#include "absl/status/status.h"
#include "eval/compiler/flat_expr_builder.h"
#include "eval/public/cel_options.h"
diff --git a/eval/public/structs/BUILD b/eval/public/structs/BUILD
index 9187518..5151bb0 100644
--- a/eval/public/structs/BUILD
+++ b/eval/public/structs/BUILD
@@ -192,7 +192,6 @@ cc_library(
hdrs = ["legacy_type_provider.h"],
deps = [
":legacy_type_adapter",
- "//base:type_provider",
"@com_google_absl//absl/types:optional",
],
)
diff --git a/eval/public/structs/field_access_impl.cc b/eval/public/structs/field_access_impl.cc
index 788a476..e4b70b3 100644
--- a/eval/public/structs/field_access_impl.cc
+++ b/eval/public/structs/field_access_impl.cc
@@ -25,6 +25,7 @@
#include "google/protobuf/arena.h"
#include "google/protobuf/map_field.h"
#include "absl/container/flat_hash_set.h"
+#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
diff --git a/eval/public/structs/legacy_type_provider.h b/eval/public/structs/legacy_type_provider.h
index b1623fc..d3d88d6 100644
--- a/eval/public/structs/legacy_type_provider.h
+++ b/eval/public/structs/legacy_type_provider.h
@@ -16,7 +16,6 @@
#define THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_STRUCTS_TYPE_PROVIDER_H_

#include "absl/types/optional.h"
-#include "base/type_provider.h"
#include "eval/public/structs/legacy_type_adapter.h"
+ using CelMap::ListKeys;
absl::StatusOr<const CelList*> ListKeys() const override { return &keys_; }

namespace google::api::expr::runtime {
@@ -25,8 +24,10 @@ namespace google::api::expr::runtime {
//
// Note: This API is not finalized. Consult the CEL team before introducing new
// implementations.
-class LegacyTypeProvider : public cel::TypeProvider {
+class LegacyTypeProvider {
public:
+ virtual ~LegacyTypeProvider() = default;
+
// Return LegacyTypeAdapter for the fully qualified type name if available.
//
// nullopt values are interpreted as not present.
@@ -45,7 +46,7 @@ class LegacyTypeProvider : public cel::TypeProvider {
// created ones, the TypeInfoApis returned from this method should be the same
// as the ones used in value creation.
virtual absl::optional<const LegacyTypeInfoApis*> ProvideLegacyTypeInfo(
- absl::string_view name) const {
+ absl::string_view) const {
return absl::nullopt;
}
};
diff --git a/base/function_result.h b/base/function_result.h
index 9bc2d67..bf6110c 100644
--- a/base/function_result.h
+++ b/base/function_result.h
@@ -26,7 +26,10 @@ namespace cel {
// allows for lazy evaluation of expensive functions.
class FunctionResult final {
public:
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdefaulted-function-deleted"
FunctionResult() = default;
+#pragma GCC diagnostic pop
FunctionResult(const FunctionResult&) = default;
FunctionResult(FunctionResult&&) = default;
FunctionResult& operator=(const FunctionResult&) = default;
private:
17 changes: 17 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ WINDOWS_SKIP_TARGETS = [
"envoy.tracers.dynamic_ot",
"envoy.tracers.datadog",
"envoy.tracers.opencensus",
# Extensions that require CEL.
"envoy.access_loggers.extension_filters.cel",
"envoy.rate_limit_descriptors.expr",
"envoy.filters.http.rate_limit_quota",
"envoy.formatter.cel",
"envoy.matching.inputs.cel_data_input",
"envoy.matching.matchers.cel_matcher",
# Wasm and RBAC extensions have a link dependency on CEL.
"envoy.access_loggers.wasm",
"envoy.bootstrap.wasm",
"envoy.filters.http.wasm",
"envoy.filters.network.wasm",
"envoy.stat_sinks.wasm",
# RBAC extensions have a link dependency on CEL.
"envoy.filters.http.rbac",
"envoy.filters.network.rbac",
"envoy.rbac.matchers.upstream_ip_port",
]

NO_HTTP3_SKIP_TARGETS = [
Expand Down
12 changes: 6 additions & 6 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Abseil",
project_desc = "Open source collection of C++ libraries drawn from the most fundamental pieces of Google’s internal codebase",
project_url = "https://abseil.io/",
version = "c8b33b0191a2db8364cacf94b267ea8a3f20ad83",
sha256 = "a7803eac00bf68eae1a84ee3b9fcf0c1173e8d9b89b2cee92c7b487ea65be2a9",
version = "20230802.1",
sha256 = "987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed",
strip_prefix = "abseil-cpp-{version}",
urls = ["https://github.com/abseil/abseil-cpp/archive/{version}.tar.gz"],
use_category = ["dataplane_core", "controlplane"],
release_date = "2023-05-16",
release_date = "2023-09-18",
cpe = "N/A",
license = "Apache-2.0",
license_url = "https://github.com/abseil/abseil-cpp/blob/{version}/LICENSE",
Expand Down Expand Up @@ -1204,8 +1204,8 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Common Expression Language (CEL) C++ library",
project_desc = "Common Expression Language (CEL) C++ library",
project_url = "https://opensource.google/projects/cel",
version = "da0aba702f44a41ec6d2eb4bbf6a9f01efc2746d",
sha256 = "d62b93fd07c6151749e83855157f3f2778d62c168318f9c40dfcfe1c336c496f",
version = "0abd738f9f54388452e6ebb0955eb039f9162b3d",
sha256 = "d163805320a782c5194b7496cdd5e8c9d9604eeffc1e531770cf6b130bc182fd",
strip_prefix = "cel-cpp-{version}",
urls = ["https://github.com/google/cel-cpp/archive/{version}.tar.gz"],
use_category = ["dataplane_ext"],
Expand All @@ -1225,7 +1225,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
"envoy.matching.inputs.cel_data_input",
"envoy.matching.matchers.cel_matcher",
],
release_date = "2023-03-08",
release_date = "2023-12-20",
cpe = "N/A",
),
com_github_google_flatbuffers = dict(
Expand Down
11 changes: 11 additions & 0 deletions source/extensions/common/wasm/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,22 @@
#include "absl/container/node_hash_map.h"
#include "absl/strings/str_cat.h"
#include "absl/synchronization/mutex.h"

#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif

#include "eval/public/cel_value.h"
#include "eval/public/containers/field_access.h"
#include "eval/public/containers/field_backed_list_impl.h"
#include "eval/public/containers/field_backed_map_impl.h"
#include "eval/public/structs/cel_proto_wrapper.h"

#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#include "include/proxy-wasm/pairs_util.h"
#include "openssl/bytestring.h"
#include "openssl/hmac.h"
Expand Down
3 changes: 3 additions & 0 deletions source/extensions/filters/common/expr/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ envoy_cc_library(
name = "evaluator_lib",
srcs = ["evaluator.cc"],
hdrs = ["evaluator.h"],
tags = ["skip_on_windows"],
deps = [
":context_lib",
"//envoy/singleton:manager_interface",
Expand All @@ -29,6 +30,7 @@ envoy_cc_library(
name = "context_lib",
srcs = ["context.cc"],
hdrs = ["context.h"],
tags = ["skip_on_windows"],
deps = [
":cel_state_lib",
"//source/common/grpc:common_lib",
Expand All @@ -52,6 +54,7 @@ envoy_cc_library(
hdrs = [
"cel_state.h",
],
tags = ["skip_on_windows"],
deps = [
"//envoy/stream_info:filter_state_interface",
"//source/common/protobuf",
Expand Down
10 changes: 10 additions & 0 deletions source/extensions/filters/common/expr/cel_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@

#include "absl/strings/string_view.h"
#include "absl/types/optional.h"

#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif

#include "eval/public/cel_value.h"

#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

namespace Envoy {
namespace Extensions {
namespace Filters {
Expand Down
1 change: 1 addition & 0 deletions source/extensions/filters/common/expr/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ class FilterStateObjectWrapper : public google::api::expr::runtime::CelMap {
// Default stubs.
int size() const override { return 0; }
bool empty() const override { return true; }
using CelMap::ListKeys;
absl::StatusOr<const google::api::expr::runtime::CelList*> ListKeys() const override {
return &WrapperFields::get().Empty;
}
Expand Down
2 changes: 2 additions & 0 deletions source/extensions/filters/common/expr/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ template <class T> class HeadersWrapper : public google::api::expr::runtime::Cel
}
int size() const override { return ListKeys().value()->size(); }
bool empty() const override { return value_ == nullptr ? true : value_->empty(); }
using CelMap::ListKeys;
absl::StatusOr<const google::api::expr::runtime::CelList*> ListKeys() const override {
if (value_ == nullptr) {
return &WrapperFields::get().Empty;
Expand Down Expand Up @@ -158,6 +159,7 @@ class BaseWrapper : public google::api::expr::runtime::CelMap {
public:
BaseWrapper(Protobuf::Arena& arena) : arena_(arena) {}
int size() const override { return 0; }
using CelMap::ListKeys;
absl::StatusOr<const google::api::expr::runtime::CelList*> ListKeys() const override {
return absl::UnimplementedError("ListKeys() is not implemented");
}
Expand Down
Loading

0 comments on commit bd1dca3

Please sign in to comment.