Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Wasm sync #195

Merged
merged 145 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
d2e2cd6
ext_authz: add metadata_context to ext_authz filter (#7818)
Aug 20, 2019
5aede46
fuzz: codec impl timeout fix + speed ups (#7963)
asraa Aug 20, 2019
c6b190b
docs: more detail about tracking down deprecated features (#7972)
alyssawilk Aug 20, 2019
9421bdd
Fix the alignement in optval of setsockopt when compiled with libc++.…
lizan Aug 20, 2019
c505077
security: some intra-entity and 3rd party embargo clarifications. (#7…
htuch Aug 21, 2019
7eed733
protobuf: IWYU (#7989)
AndresGuedez Aug 21, 2019
f04dccb
api: add name into filter chain (#7966)
lambdai Aug 21, 2019
5d42b9b
rds: validate config in depth before update config dump (#7956)
lizan Aug 21, 2019
87c38e1
tls: maintain a free slot index set in TLS InstanceImpl to allocate i…
stevenzzzz Aug 21, 2019
09466b5
redis: handle invalid ip address from cluster slots and added tests (…
HenryYYang Aug 21, 2019
6ab225d
protobuf: report field numbers for unknown fields. (#7978)
htuch Aug 21, 2019
4549d12
Content in envoy docs does not cover whole page (#7993)
mk46 Aug 21, 2019
719245f
stats: Add option to switch between fake and real symbol-tables on th…
jmarantz Aug 21, 2019
c7110f8
api config: add build rules for go protos (#7987)
nareddyt Aug 22, 2019
7267542
test: don't use <experimental/filesystem> on macOS. (#8000)
PiotrSikora Aug 22, 2019
ffeffd7
event: adding the capability of creating an alarm with a given scope…
alyssawilk Aug 22, 2019
d4dc0a5
ext authz: add dns san support for ext authz service (#7948)
ramaraochavali Aug 22, 2019
e1ecb02
accesslog: don't open log file with read flag (#7998)
lizan Aug 22, 2019
43c4acd
protobuf: towards unifying PGV, deprecated and unknown field validati…
htuch Aug 22, 2019
b2da45a
http: forwarding x-forwarded-proto from trusted proxies (#7995)
alyssawilk Aug 22, 2019
f12adac
build: adding an option to hard-fail when deprecated config is used. …
alyssawilk Aug 22, 2019
797d58f
envoy_cc_library: add export of foo_with_external_headers (#8005)
oschaaf Aug 22, 2019
57d48a3
ci: add fuzz test targets to ci (#7949)
asraa Aug 22, 2019
9a3a234
tls: support BoringSSL private key async functionality (#6326)
ipuustin Aug 22, 2019
b44a00b
use SymbolTableCreator rather than fakes in a few stray places. (#8006)
jmarantz Aug 22, 2019
69f805c
[router] Add SRDS configUpdate impl (#7451)
stevenzzzz Aug 22, 2019
225ad90
Fix version history (#8021)
Aug 23, 2019
7f97060
tools: sync tool for envoyproxy/assignable team. (#8015)
htuch Aug 23, 2019
faad477
redis: fix onHostHealthUpdate got called before the cluster is resolv…
HenryYYang Aug 23, 2019
e67923f
api/build: migrate UDPA proto tree to external cncf/udpa repository. …
htuch Aug 23, 2019
e958cf9
http: tracking active session under L7 timers (#7782)
alyssawilk Aug 23, 2019
73c2b64
upstream: remove thread local cluster after triggering call backs (#8…
ramaraochavali Aug 23, 2019
07e3e28
upstream: Introducing close_connections_on_host_set_change property (…
Aug 23, 2019
dbb11fd
upstream: delete stale TODO (#8028)
mattklein123 Aug 23, 2019
640b5a4
Enhance comment about MonotonicTime (#8011)
fcrisciani Aug 23, 2019
fd19af8
build: some missing dep fixups for Google import. (#8026)
htuch Aug 23, 2019
eff0201
introduce safe regex matcher based on re2 engine (#7878)
mattklein123 Aug 23, 2019
25e3e86
docs: reorganize configuration tree (#8027)
mattklein123 Aug 23, 2019
903351f
build: missing regex include. (#8032)
htuch Aug 23, 2019
6ff0bce
[headermap] speedup for appending data (#8029)
asraa Aug 25, 2019
4d78ff5
eds: avoid send too many ClusterLoadAssignment requests (#7976)
l8huang Aug 25, 2019
b0aca30
Set the bazel verison to 0.28.1 explicitly (#8037)
Yikun Aug 26, 2019
fc32b64
Read_policy is not set correctly. (#8034)
HenryYYang Aug 26, 2019
5c2b34b
admin: fix /server_info hot restart version (#8022)
mattklein123 Aug 26, 2019
fdd0e01
test: adding debug hints for integration test config failures (#8038)
alyssawilk Aug 26, 2019
d39bd81
udp_listener: refactor ActiveUdpListener creation (#7884)
danzh2010 Aug 26, 2019
8bdebbf
accesslog: implement TCP gRPC access logger (#7941)
lizan Aug 26, 2019
816d6f1
tracing: add OpenCensus agent exporter support to OpenCensus driver. …
g-easy Aug 27, 2019
e1cd4cc
Exporting platform_impl_lib headers (#8045)
oschaaf Aug 27, 2019
854e800
access_log: minimal log file error handling (#7938)
zuercher Aug 27, 2019
1fc6c6e
tracing: add grpc-status and grpc-message to spans (#7996)
cgilmour Aug 27, 2019
0a3fc6a
fuzz: add bounds to statsh flush interval (#8043)
asraa Aug 27, 2019
44634d8
Improve tools/stack_decode.py (#8041)
LukeShu Aug 27, 2019
0006efc
build: tell googletest to use absl stacktrace (#8047)
lizan Aug 27, 2019
6dd0ee1
Update references to local scripts to enable using build container fo…
scheler Aug 27, 2019
d99e7f6
bazel: patch gRPC to fix Envoy builds with glibc v2.30 (#7971)
Aug 27, 2019
e674640
build: link C++ stdlib dynamically in sanitizer runs (#8019)
lizan Aug 28, 2019
b020b63
test: cleaning up test runtime (#8012)
alyssawilk Aug 28, 2019
64243c9
test: improved coverage and handling of deprecated config (#8057)
alyssawilk Aug 28, 2019
f8e42ae
[Docs typo] Remote Executioon -> Remote Execution (#8061)
colinschoen Aug 28, 2019
f80188e
api: Fix duplicate java_outer_classname declarations (#8059)
Aug 28, 2019
b8966cb
http: making the behavior of the response Server header configurable …
alyssawilk Aug 28, 2019
f588da0
use bazelversion for filter-example too (#8069)
lizan Aug 28, 2019
c2e8eda
grpc-httpjson-transcode: Update for RFC2045 support (#8065)
cypres Aug 28, 2019
5e45d48
stats: Clean up all calls to Scope::counter() et al in production cod…
jmarantz Aug 28, 2019
7f060b6
tls_inspector: inline the recv in the onAccept (#7951)
lambdai Aug 29, 2019
0fde42e
Fixes gcc 8.3.1 build failure due to FilterChainBenchmarkFixture::Set…
Aug 29, 2019
9ac491a
test: fix ups for various deprecated fields (#8068)
alyssawilk Aug 29, 2019
8556a75
include: add log dependency header to connection_handler.h (#8072)
nareddyt Aug 29, 2019
4f2c5a4
quiche: Update QUICHE dep (#8044)
danzh2010 Aug 29, 2019
29f199c
tools: deprecated field check in Route Checker tool (#8058)
jyotimahapatra Aug 29, 2019
6c6e18e
tracing: Add support for sending data in Zipkin v2 format (#6985)
dio Aug 30, 2019
0b0aa3f
Route Checker tool Fix code coverage bug in proto based schema (#8101)
jyotimahapatra Aug 30, 2019
7960564
[hcm] Add scoped RDS routing into HCM (#7762)
stevenzzzz Aug 30, 2019
678bf8c
owners: add @asraa and @lambdai to OWNERS. (#8110)
htuch Aug 30, 2019
dad0f2e
protobuf: recursively validate unknown fields. (#8094)
htuch Sep 2, 2019
0eab93b
Fuzz reuse (#8119)
securityinsanity Sep 3, 2019
0b026cf
Set INCLUDE_DIRECTORIES so libcurl can find local urlapi.h (#8113)
jmillikin-stripe Sep 3, 2019
911f3b0
cleanup: move test utility methods in ScopedRdsIntegrationTest to bas…
stevenzzzz Sep 3, 2019
1339ed2
upstream: fix invalid access of ClusterMap iterator during warming cl…
AndresGuedez Sep 3, 2019
b28edca
api:Add a flag to disable overprovisioning in ClusterLoadAssignment (…
jaychenatr Sep 3, 2019
085d72b
api: clone v2[alpha] to v3alpha. (#8125)
htuch Sep 3, 2019
0ef3137
dubbo: Fix heartbeat packet parsing error (#8103)
zyfjeff Sep 3, 2019
cf55298
stats: Shared cluster isolated stats (#8118)
jmarantz Sep 3, 2019
39a4423
protodoc: upgrade to Python 3. (#8129)
htuch Sep 3, 2019
b06e2b5
protodoc: single source-of-truth for doc protos. (#8132)
htuch Sep 3, 2019
d504fde
api: organize go_proto_libraries (#8003)
kyessenov Sep 4, 2019
1b3b4ae
api: straggler v2alpha1 -> v3alpha clone. (#8133)
htuch Sep 4, 2019
2e6695b
docs: remove extraneous escape (#8150)
zuercher Sep 4, 2019
f62a389
Do not 503 on Upgrade: h2c instead remove the header and ignore. (#7981)
jplevyak Sep 4, 2019
32590dc
docs: add line on installing xcode for macOS build flow (#8139)
LisaLudique Sep 4, 2019
aeb5d69
docs: note which header expressions cannot be used for request header…
zuercher Sep 4, 2019
4478c19
api: use traffic_direction over operation_name if specified (#7999)
kyessenov Sep 4, 2019
d11c7e7
add more diagnostic logs (#8153)
yxue Sep 5, 2019
277e717
http conn man: add tracing config for path length in tag (#8095)
douglas-reid Sep 5, 2019
d21d92c
cds: Add general-purpose LB policy configuration (#7744)
markdroth Sep 5, 2019
22e4827
thrift_proxy: fix crash on invalid transport/protocol (#8143)
zuercher Sep 5, 2019
e7f0b71
api: strip gogoproto annotations (#8163)
kyessenov Sep 6, 2019
c6f0ee2
hotrestart: remove dynamic_resources from server config used by hotre…
l8huang Sep 6, 2019
84ceadc
clang-tidy: misc-unused-using-decls (#8159)
derekargueta Sep 6, 2019
5dc6f09
build: curl with c-ares, nghttp2 and zlib (#8154)
troshko111 Sep 6, 2019
838eb20
log: add upstream TLS info (#7911)
kyessenov Sep 6, 2019
cc03f79
fix windows implementation of PlatformImpl (#8169)
achasveachas Sep 6, 2019
451bfe8
Update Opencensus SHA (#8173)
bianpengyuan Sep 7, 2019
6f273c2
Outlier Detection: use gRPC status code for detecting failures (#7942)
ZhouyihaiDing Sep 7, 2019
99e3c65
fix build (#8177)
derekargueta Sep 8, 2019
ced130a
docs: improving websocket docs (#8156)
alyssawilk Sep 9, 2019
3f63838
Upstream WebAssembly VM and Null VM from envoyproxy/envoy-wasm. (#8020)
jplevyak Sep 9, 2019
44a8588
quiche: implement Envoy Quic stream and connection (#7721)
danzh2010 Sep 9, 2019
809f0e3
protodoc/api_proto_plugin: generic API protoc plugin framework. (#8157)
htuch Sep 9, 2019
874d7d3
adaptive concurrency: Gradient algorithm implementation (#7908)
Sep 9, 2019
5aea70c
ext_authz: Check for cluster before sending HTTP request (#8144)
dio Sep 10, 2019
66cc26a
make getters const-ref (#8192)
kyessenov Sep 10, 2019
d5515ae
test: add curl features check (#8194)
troshko111 Sep 10, 2019
cee989a
subset lb: allow ring hash/maglev LB to work with subsets (#8030)
zuercher Sep 10, 2019
ad10a97
redis: add a request time metric to redis upstream (#7890)
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg Sep 10, 2019
38b926c
bazel: update bazel to 0.29.1 (#8198)
lizan Sep 10, 2019
e2eb258
upstream: Add ability to disable host selection during panic (#8024)
csssuf Sep 11, 2019
a758e8c
metrics service: flush histogram buckets (#8180)
ramaraochavali Sep 11, 2019
eb11fde
tracing: fix random sample fraction percent (#8205)
bianpengyuan Sep 11, 2019
c78c4b4
stats: Add per-host memory usage test case to stats_integration_test …
antoniovicente Sep 11, 2019
c9703f9
router check tool: add flag for only printing failed tests (#8160)
Sep 11, 2019
0ee3cc3
fix link to runtime docs (#8204)
derekargueta Sep 11, 2019
c5ffdda
config: make SlotImpl detachable from its owner, and add a new runOnA…
stevenzzzz Sep 11, 2019
da38e73
test: remove static config from subset lb integration test (#8203)
zuercher Sep 11, 2019
9de651a
cleanup: clarify Cluster.filters and Dispatcher::createClientConnecti…
fredlas Sep 11, 2019
7df4775
redis: health check is not sending the auth command on its connection…
HenryYYang Sep 11, 2019
73ad41a
redis: mirroring should work when default value is zero, not just gre…
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg Sep 11, 2019
d0e1db6
tools: regularize pip/venv for format_python_tools.py. (#8176)
htuch Sep 11, 2019
90ed92f
absl: Absl hash hook in a couple of places rather than hash functors …
jmarantz Sep 12, 2019
5551315
Update dependency: jwt_verify_lib (#8212)
dgn Sep 12, 2019
36cf26b
upstream: add failure percentage-based outlier detection (#8130)
csssuf Sep 12, 2019
d7392c8
Replace deprecated thread annotations macros. (#8237)
yanavlasov Sep 13, 2019
bd58c11
Update protoc-gen-validate (PGV) (#8234)
achasveachas Sep 13, 2019
71376f1
upstream: use named constants for outlier detection config defaults (…
csssuf Sep 13, 2019
82a9e04
server: add a post init lifecycle stage (#8217)
junr03 Sep 13, 2019
706f910
docs: document access control conditions and attributes (#8230)
kyessenov Sep 13, 2019
5d59dd9
server: return processContext as optional reference (#8238)
eziskind Sep 16, 2019
d159697
Update envoy.yaml in Redis proxy example (#8220)
rklabs Sep 16, 2019
5fb7565
quiche: implement ActiveQuicListener (#7896)
danzh2010 Sep 16, 2019
c5738e1
srds: allow SRDS pass on scope-not-found queries to filter-chain (iss…
stevenzzzz Sep 16, 2019
002342e
Merge remote-tracking branch 'envoyproxy/master' into wasm-sync
jplevyak Sep 16, 2019
cd5c762
Updated to new envoyproxy master branch.
jplevyak Sep 16, 2019
5639ef7
Remove offending go proto option.
jplevyak Sep 17, 2019
ef8e530
Fix format/tidy issues.
jplevyak Sep 17, 2019
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
Prev Previous commit
Next Next commit
protobuf: towards unifying PGV, deprecated and unknown field validati…
…on. (#8002)

This is part of #7980; basically, we want to leverage the recursive pass
that already exists for the deprecated check. This PR does not implement
the recursive behavior yet for unknown fields though, because there is a
ton of churn, so this PR just has the mechanical bits. We switch
plumbing of validation visitor into places such as anyConvert() and
instead pass this to MessageUtil::validate.

There are a bunch of future followups planned in additional PRs:
* Combine the recursive pass for unknown/deprecated check in
  MessageUtil::validate().
* Add mitigation for #5965 by copying to a temporary before recursive
  expansion.
* [Future] consider moving deprecated reporting into a message
  validation visitor handler.

Risk level: Low
Testing: Some new //test/common/protobuf::utility_test unit test.

Signed-off-by: Harvey Tuch <[email protected]>
  • Loading branch information
htuch authored Aug 22, 2019
commit 43c4acd27b85e4e28beeff9858aca7a110ce5863
1 change: 1 addition & 0 deletions include/envoy/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ envoy_cc_library(
":resource_monitor_interface",
"//include/envoy/api:api_interface",
"//include/envoy/event:dispatcher_interface",
"//include/envoy/protobuf:message_validator_interface",
],
)

Expand Down
5 changes: 4 additions & 1 deletion include/envoy/server/filter_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,14 @@ class ProtocolOptionsFactory {
* implementation is unable to produce a factory with the provided parameters, it should throw an
* EnvoyException.
* @param config supplies the protobuf configuration for the filter
* @param validation_visitor message validation visitor instance.
* @return Upstream::ProtocolOptionsConfigConstSharedPtr the protocol options
*/
virtual Upstream::ProtocolOptionsConfigConstSharedPtr
createProtocolOptionsConfig(const Protobuf::Message& config) {
createProtocolOptionsConfig(const Protobuf::Message& config,
ProtobufMessage::ValidationVisitor& validation_visitor) {
UNREFERENCED_PARAMETER(config);
UNREFERENCED_PARAMETER(validation_visitor);
return nullptr;
}

Expand Down
7 changes: 7 additions & 0 deletions include/envoy/server/resource_monitor_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "envoy/api/api.h"
#include "envoy/common/pure.h"
#include "envoy/event/dispatcher.h"
#include "envoy/protobuf/message_validator.h"
#include "envoy/server/resource_monitor.h"

#include "common/protobuf/protobuf.h"
Expand All @@ -25,6 +26,12 @@ class ResourceMonitorFactoryContext {
* @return reference to the Api object
*/
virtual Api::Api& api() PURE;

/**
* @return ProtobufMessage::ValidationVisitor& validation visitor for filter configuration
* messages.
*/
virtual ProtobufMessage::ValidationVisitor& messageValidationVisitor() PURE;
};

/**
Expand Down
6 changes: 4 additions & 2 deletions include/envoy/upstream/retry.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ class RetryPriorityFactory {
public:
virtual ~RetryPriorityFactory() = default;

virtual RetryPrioritySharedPtr createRetryPriority(const Protobuf::Message& config,
uint32_t retry_count) PURE;
virtual RetryPrioritySharedPtr
createRetryPriority(const Protobuf::Message& config,
ProtobufMessage::ValidationVisitor& validation_visitor,
uint32_t retry_count) PURE;

virtual std::string name() const PURE;

Expand Down
31 changes: 18 additions & 13 deletions source/common/access_log/access_log_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ bool ComparisonFilter::compareAgainstValue(uint64_t lhs) {

FilterPtr
FilterFactory::fromProto(const envoy::config::filter::accesslog::v2::AccessLogFilter& config,
Runtime::Loader& runtime, Runtime::RandomGenerator& random) {
Runtime::Loader& runtime, Runtime::RandomGenerator& random,
ProtobufMessage::ValidationVisitor& validation_visitor) {
switch (config.filter_specifier_case()) {
case envoy::config::filter::accesslog::v2::AccessLogFilter::kStatusCodeFilter:
return FilterPtr{new StatusCodeFilter(config.status_code_filter(), runtime)};
Expand All @@ -66,19 +67,19 @@ FilterFactory::fromProto(const envoy::config::filter::accesslog::v2::AccessLogFi
case envoy::config::filter::accesslog::v2::AccessLogFilter::kRuntimeFilter:
return FilterPtr{new RuntimeFilter(config.runtime_filter(), runtime, random)};
case envoy::config::filter::accesslog::v2::AccessLogFilter::kAndFilter:
return FilterPtr{new AndFilter(config.and_filter(), runtime, random)};
return FilterPtr{new AndFilter(config.and_filter(), runtime, random, validation_visitor)};
case envoy::config::filter::accesslog::v2::AccessLogFilter::kOrFilter:
return FilterPtr{new OrFilter(config.or_filter(), runtime, random)};
return FilterPtr{new OrFilter(config.or_filter(), runtime, random, validation_visitor)};
case envoy::config::filter::accesslog::v2::AccessLogFilter::kHeaderFilter:
return FilterPtr{new HeaderFilter(config.header_filter())};
case envoy::config::filter::accesslog::v2::AccessLogFilter::kResponseFlagFilter:
MessageUtil::validate(config);
MessageUtil::validate(config, validation_visitor);
return FilterPtr{new ResponseFlagFilter(config.response_flag_filter())};
case envoy::config::filter::accesslog::v2::AccessLogFilter::kGrpcStatusFilter:
MessageUtil::validate(config);
MessageUtil::validate(config, validation_visitor);
return FilterPtr{new GrpcStatusFilter(config.grpc_status_filter())};
case envoy::config::filter::accesslog::v2::AccessLogFilter::kExtensionFilter:
MessageUtil::validate(config);
MessageUtil::validate(config, validation_visitor);
{
auto& factory = Config::Utility::getAndCheckFactory<ExtensionFilterFactory>(
config.extension_filter().name());
Expand Down Expand Up @@ -140,19 +141,22 @@ bool RuntimeFilter::evaluate(const StreamInfo::StreamInfo&, const Http::HeaderMa

OperatorFilter::OperatorFilter(const Protobuf::RepeatedPtrField<
envoy::config::filter::accesslog::v2::AccessLogFilter>& configs,
Runtime::Loader& runtime, Runtime::RandomGenerator& random) {
Runtime::Loader& runtime, Runtime::RandomGenerator& random,
ProtobufMessage::ValidationVisitor& validation_visitor) {
for (const auto& config : configs) {
filters_.emplace_back(FilterFactory::fromProto(config, runtime, random));
filters_.emplace_back(FilterFactory::fromProto(config, runtime, random, validation_visitor));
}
}

OrFilter::OrFilter(const envoy::config::filter::accesslog::v2::OrFilter& config,
Runtime::Loader& runtime, Runtime::RandomGenerator& random)
: OperatorFilter(config.filters(), runtime, random) {}
Runtime::Loader& runtime, Runtime::RandomGenerator& random,
ProtobufMessage::ValidationVisitor& validation_visitor)
: OperatorFilter(config.filters(), runtime, random, validation_visitor) {}

AndFilter::AndFilter(const envoy::config::filter::accesslog::v2::AndFilter& config,
Runtime::Loader& runtime, Runtime::RandomGenerator& random)
: OperatorFilter(config.filters(), runtime, random) {}
Runtime::Loader& runtime, Runtime::RandomGenerator& random,
ProtobufMessage::ValidationVisitor& validation_visitor)
: OperatorFilter(config.filters(), runtime, random, validation_visitor) {}

bool OrFilter::evaluate(const StreamInfo::StreamInfo& info, const Http::HeaderMap& request_headers,
const Http::HeaderMap& response_headers,
Expand Down Expand Up @@ -268,7 +272,8 @@ AccessLogFactory::fromProto(const envoy::config::filter::accesslog::v2::AccessLo
Server::Configuration::FactoryContext& context) {
FilterPtr filter;
if (config.has_filter()) {
filter = FilterFactory::fromProto(config.filter(), context.runtime(), context.random());
filter = FilterFactory::fromProto(config.filter(), context.runtime(), context.random(),
context.messageValidationVisitor());
}

auto& factory =
Expand Down
12 changes: 8 additions & 4 deletions source/common/access_log/access_log_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class FilterFactory {
* Read a filter definition from proto and instantiate a concrete filter class.
*/
static FilterPtr fromProto(const envoy::config::filter::accesslog::v2::AccessLogFilter& config,
Runtime::Loader& runtime, Runtime::RandomGenerator& random);
Runtime::Loader& runtime, Runtime::RandomGenerator& random,
ProtobufMessage::ValidationVisitor& validation_visitor);
};

/**
Expand Down Expand Up @@ -82,7 +83,8 @@ class OperatorFilter : public Filter {
public:
OperatorFilter(const Protobuf::RepeatedPtrField<
envoy::config::filter::accesslog::v2::AccessLogFilter>& configs,
Runtime::Loader& runtime, Runtime::RandomGenerator& random);
Runtime::Loader& runtime, Runtime::RandomGenerator& random,
ProtobufMessage::ValidationVisitor& validation_visitor);

protected:
std::vector<FilterPtr> filters_;
Expand All @@ -94,7 +96,8 @@ class OperatorFilter : public Filter {
class AndFilter : public OperatorFilter {
public:
AndFilter(const envoy::config::filter::accesslog::v2::AndFilter& config, Runtime::Loader& runtime,
Runtime::RandomGenerator& random);
Runtime::RandomGenerator& random,
ProtobufMessage::ValidationVisitor& validation_visitor);

// AccessLog::Filter
bool evaluate(const StreamInfo::StreamInfo& info, const Http::HeaderMap& request_headers,
Expand All @@ -108,7 +111,8 @@ class AndFilter : public OperatorFilter {
class OrFilter : public OperatorFilter {
public:
OrFilter(const envoy::config::filter::accesslog::v2::OrFilter& config, Runtime::Loader& runtime,
Runtime::RandomGenerator& random);
Runtime::RandomGenerator& random,
ProtobufMessage::ValidationVisitor& validation_visitor);

// AccessLog::Filter
bool evaluate(const StreamInfo::StreamInfo& info, const Http::HeaderMap& request_headers,
Expand Down
19 changes: 11 additions & 8 deletions source/common/protobuf/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,12 @@ class MessageUtil {
* @param message message to validate.
* @throw ProtoValidationException if the message does not satisfy its type constraints.
*/
template <class MessageType> static void validate(const MessageType& message) {
template <class MessageType>
static void validate(const MessageType& message,
ProtobufMessage::ValidationVisitor& validation_visitor) {
// Log warnings or throw errors if deprecated fields are in use.
checkForDeprecation(message);
checkUnknownFields(message, validation_visitor);

std::string err;
if (!Validate(message, &err)) {
Expand All @@ -249,14 +252,14 @@ class MessageUtil {
static void loadFromFileAndValidate(const std::string& path, MessageType& message,
ProtobufMessage::ValidationVisitor& validation_visitor) {
loadFromFile(path, message, validation_visitor);
validate(message);
validate(message, validation_visitor);
}

template <class MessageType>
static void loadFromYamlAndValidate(const std::string& yaml, MessageType& message,
ProtobufMessage::ValidationVisitor& validation_visitor) {
loadFromYaml(yaml, message, validation_visitor);
validate(message);
validate(message, validation_visitor);
}

/**
Expand All @@ -268,9 +271,11 @@ class MessageUtil {
* @throw ProtoValidationException if the message does not satisfy its type constraints.
*/
template <class MessageType>
static const MessageType& downcastAndValidate(const Protobuf::Message& config) {
static const MessageType&
downcastAndValidate(const Protobuf::Message& config,
ProtobufMessage::ValidationVisitor& validation_visitor) {
const auto& typed_config = dynamic_cast<MessageType>(config);
validate(typed_config);
validate(typed_config, validation_visitor);
return typed_config;
}

Expand All @@ -282,13 +287,11 @@ class MessageUtil {
* @return MessageType the typed message inside the Any.
*/
template <class MessageType>
static inline MessageType anyConvert(const ProtobufWkt::Any& message,
ProtobufMessage::ValidationVisitor& validation_visitor) {
static inline MessageType anyConvert(const ProtobufWkt::Any& message) {
MessageType typed_message;
if (!message.UnpackTo(&typed_message)) {
throw EnvoyException("Unable to unpack " + message.DebugString());
}
checkUnknownFields(typed_message, validation_visitor);
return typed_message;
};

Expand Down
6 changes: 4 additions & 2 deletions source/common/router/config_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ HedgePolicyImpl::HedgePolicyImpl()
: initial_requests_(1), additional_request_chance_({}), hedge_on_per_try_timeout_(false) {}

RetryPolicyImpl::RetryPolicyImpl(const envoy::api::v2::route::RetryPolicy& retry_policy,
ProtobufMessage::ValidationVisitor& validation_visitor) {
ProtobufMessage::ValidationVisitor& validation_visitor)
: validation_visitor_(&validation_visitor) {
per_try_timeout_ =
std::chrono::milliseconds(PROTOBUF_GET_MS_OR_DEFAULT(retry_policy, per_try_timeout, 0));
num_retries_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(retry_policy, num_retries, 1);
Expand Down Expand Up @@ -141,7 +142,8 @@ Upstream::RetryPrioritySharedPtr RetryPolicyImpl::retryPriority() const {
auto& factory = Envoy::Config::Utility::getAndCheckFactory<Upstream::RetryPriorityFactory>(
retry_priority_config_.first);

return factory.createRetryPriority(*retry_priority_config_.second, num_retries_);
return factory.createRetryPriority(*retry_priority_config_.second, *validation_visitor_,
num_retries_);
}

CorsPolicyImpl::CorsPolicyImpl(const envoy::api::v2::route::CorsPolicy& config,
Expand Down
1 change: 1 addition & 0 deletions source/common/router/config_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class RetryPolicyImpl : public RetryPolicy {
std::vector<uint32_t> retriable_status_codes_;
absl::optional<std::chrono::milliseconds> base_interval_;
absl::optional<std::chrono::milliseconds> max_interval_;
ProtobufMessage::ValidationVisitor* validation_visitor_{};
};

/**
Expand Down
5 changes: 2 additions & 3 deletions source/common/router/rds_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ void RdsRouteConfigSubscription::onConfigUpdate(
if (!validateUpdateSize(resources.size())) {
return;
}
auto route_config = MessageUtil::anyConvert<envoy::api::v2::RouteConfiguration>(
resources[0], validation_visitor_);
MessageUtil::validate(route_config);
auto route_config = MessageUtil::anyConvert<envoy::api::v2::RouteConfiguration>(resources[0]);
MessageUtil::validate(route_config, validation_visitor_);
if (route_config.name() != route_config_name_) {
throw EnvoyException(fmt::format("Unexpected RDS configuration (expecting {}): {}",
route_config_name_, route_config.name()));
Expand Down
4 changes: 1 addition & 3 deletions source/common/router/rds_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ class RdsRouteConfigSubscription : Envoy::Config::SubscriptionCallbacks,
void onConfigUpdateFailed(Envoy::Config::ConfigUpdateFailureReason reason,
const EnvoyException* e) override;
std::string resourceName(const ProtobufWkt::Any& resource) override {
return MessageUtil::anyConvert<envoy::api::v2::RouteConfiguration>(resource,
validation_visitor_)
.name();
return MessageUtil::anyConvert<envoy::api::v2::RouteConfiguration>(resource).name();
}

RdsRouteConfigSubscription(
Expand Down
5 changes: 2 additions & 3 deletions source/common/router/route_config_update_receiver_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ void RouteConfigUpdateReceiverImpl::updateVhosts(
const Protobuf::RepeatedPtrField<envoy::api::v2::Resource>& added_resources) {
for (const auto& resource : added_resources) {
envoy::api::v2::route::VirtualHost vhost =
MessageUtil::anyConvert<envoy::api::v2::route::VirtualHost>(resource.resource(),
validation_visitor_);
MessageUtil::validate(vhost);
MessageUtil::anyConvert<envoy::api::v2::route::VirtualHost>(resource.resource());
MessageUtil::validate(vhost, validation_visitor_);
auto found = vhosts.find(vhost.name());
if (found != vhosts.end()) {
vhosts.erase(found);
Expand Down
6 changes: 3 additions & 3 deletions source/common/router/scoped_rds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ void ScopedRdsConfigSubscription::onConfigUpdate(
const std::string& version_info) {
std::vector<envoy::api::v2::ScopedRouteConfiguration> scoped_routes;
for (const auto& resource_any : resources) {
scoped_routes.emplace_back(MessageUtil::anyConvert<envoy::api::v2::ScopedRouteConfiguration>(
resource_any, validation_visitor_));
scoped_routes.emplace_back(
MessageUtil::anyConvert<envoy::api::v2::ScopedRouteConfiguration>(resource_any));
}

std::unordered_set<std::string> resource_names;
Expand All @@ -117,7 +117,7 @@ void ScopedRdsConfigSubscription::onConfigUpdate(
}
}
for (const auto& scoped_route : scoped_routes) {
MessageUtil::validate(scoped_route);
MessageUtil::validate(scoped_route, validation_visitor_);
}

// TODO(AndresGuedez): refactor such that it can be shared with other delta APIs (e.g., CDS).
Expand Down
4 changes: 1 addition & 3 deletions source/common/router/scoped_rds.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ class ScopedRdsConfigSubscription : public Envoy::Config::DeltaConfigSubscriptio
ConfigSubscriptionCommonBase::onConfigUpdateFailed();
}
std::string resourceName(const ProtobufWkt::Any& resource) override {
return MessageUtil::anyConvert<envoy::api::v2::ScopedRouteConfiguration>(resource,
validation_visitor_)
.name();
return MessageUtil::anyConvert<envoy::api::v2::ScopedRouteConfiguration>(resource).name();
}

const std::string name_;
Expand Down
3 changes: 1 addition & 2 deletions source/common/router/vhds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ VhdsSubscription::VhdsSubscription(RouteConfigUpdatePtr& config_update_info,
scope_(factory_context.scope().createScope(stat_prefix + "vhds." +
config_update_info_->routeConfigName() + ".")),
stats_({ALL_VHDS_STATS(POOL_COUNTER(*scope_))}),
route_config_providers_(route_config_providers),
validation_visitor_(factory_context.messageValidationVisitor()) {
route_config_providers_(route_config_providers) {
const auto& config_source = config_update_info_->routeConfiguration()
.vhds()
.config_source()
Expand Down
5 changes: 1 addition & 4 deletions source/common/router/vhds.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ class VhdsSubscription : Envoy::Config::SubscriptionCallbacks,
void onConfigUpdateFailed(Envoy::Config::ConfigUpdateFailureReason reason,
const EnvoyException* e) override;
std::string resourceName(const ProtobufWkt::Any& resource) override {
return MessageUtil::anyConvert<envoy::api::v2::route::VirtualHost>(resource,
validation_visitor_)
.name();
return MessageUtil::anyConvert<envoy::api::v2::route::VirtualHost>(resource).name();
}

RouteConfigUpdatePtr& config_update_info_;
Expand All @@ -70,7 +68,6 @@ class VhdsSubscription : Envoy::Config::SubscriptionCallbacks,
Stats::ScopePtr scope_;
VhdsStats stats_;
std::unordered_set<RouteConfigProvider*>& route_config_providers_;
ProtobufMessage::ValidationVisitor& validation_visitor_;
};

using VhdsSubscriptionPtr = std::unique_ptr<VhdsSubscription>;
Expand Down
5 changes: 2 additions & 3 deletions source/common/runtime/runtime_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,8 @@ RtdsSubscription::RtdsSubscription(
void RtdsSubscription::onConfigUpdate(const Protobuf::RepeatedPtrField<ProtobufWkt::Any>& resources,
const std::string&) {
validateUpdateSize(resources.size());
auto runtime = MessageUtil::anyConvert<envoy::service::discovery::v2::Runtime>(
resources[0], validation_visitor_);
MessageUtil::validate(runtime);
auto runtime = MessageUtil::anyConvert<envoy::service::discovery::v2::Runtime>(resources[0]);
MessageUtil::validate(runtime, validation_visitor_);
if (runtime.name() != resource_name_) {
throw EnvoyException(
fmt::format("Unexpected RTDS runtime (expecting {}): {}", resource_name_, runtime.name()));
Expand Down
4 changes: 1 addition & 3 deletions source/common/runtime/runtime_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ struct RtdsSubscription : Config::SubscriptionCallbacks, Logger::Loggable<Logger
void onConfigUpdateFailed(Envoy::Config::ConfigUpdateFailureReason reason,
const EnvoyException* e) override;
std::string resourceName(const ProtobufWkt::Any& resource) override {
return MessageUtil::anyConvert<envoy::service::discovery::v2::Runtime>(resource,
validation_visitor_)
.name();
return MessageUtil::anyConvert<envoy::service::discovery::v2::Runtime>(resource).name();
}

void start();
Expand Down
5 changes: 2 additions & 3 deletions source/common/secret/sds_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ SdsApi::SdsApi(envoy::api::v2::core::ConfigSource sds_config, absl::string_view
void SdsApi::onConfigUpdate(const Protobuf::RepeatedPtrField<ProtobufWkt::Any>& resources,
const std::string& version_info) {
validateUpdateSize(resources.size());
auto secret =
MessageUtil::anyConvert<envoy::api::v2::auth::Secret>(resources[0], validation_visitor_);
MessageUtil::validate(secret);
auto secret = MessageUtil::anyConvert<envoy::api::v2::auth::Secret>(resources[0]);
MessageUtil::validate(secret, validation_visitor_);

if (secret.name() != sds_config_name_) {
throw EnvoyException(
Expand Down
Loading