forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: forwarding x-forwarded-proto from trusted proxies (envoyproxy#7995
) Trusting the x-forwarded-proto header from trusted proxies. If Envoy is operating as an edge proxy but has a trusted hop in front, the trusted proxy should be allowed to set x-forwarded-proto and its x-forwarded-proto should be preserved. Guarded by envoy.reloadable_features.trusted_forwarded_proto, default on. Risk Level: Medium (L7 header changes) but guarded Testing: new unit tests Docs Changes: n/a Release Notes: inline Fixes envoyproxy#4496 Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
- Loading branch information
1 parent
d24427d
commit 9c065e1
Showing
7 changed files
with
136 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// A simple test utility to easily allow for runtime feature overloads in unit tests. | ||
// | ||
// As long as this class is in scope one can do runtime feature overrides: | ||
// | ||
// TestScopedRuntime scoped_runtime; | ||
// Runtime::LoaderSingleton::getExisting()->mergeValues( | ||
// {{"envoy.reloadable_features.test_feature_true", "false"}}); | ||
// | ||
// As long as a TestScopedRuntime exists, Runtime::LoaderSingleton::getExisting()->mergeValues() | ||
// can safely be called to override runtime values. | ||
|
||
#pragma once | ||
|
||
#include "common/runtime/runtime_impl.h" | ||
#include "common/stats/isolated_store_impl.h" | ||
|
||
#include "test/mocks/event/mocks.h" | ||
#include "test/mocks/init/mocks.h" | ||
#include "test/mocks/local_info/mocks.h" | ||
#include "test/mocks/protobuf/mocks.h" | ||
#include "test/mocks/runtime/mocks.h" | ||
#include "test/mocks/thread_local/mocks.h" | ||
|
||
#include "gmock/gmock.h" | ||
|
||
namespace Envoy { | ||
|
||
// TODO(alyssawilk) move existing runtime tests over to using this. | ||
class TestScopedRuntime { | ||
public: | ||
TestScopedRuntime() : api_(Api::createApiForTest()) { | ||
envoy::config::bootstrap::v2::LayeredRuntime config; | ||
// The existence of an admin layer is required for mergeValues() to work. | ||
config.add_layers()->mutable_admin_layer(); | ||
|
||
loader_ = std::make_unique<Runtime::ScopedLoaderSingleton>( | ||
std::make_unique<Runtime::LoaderImpl>(dispatcher_, tls_, config, local_info_, init_manager_, | ||
store_, generator_, validation_visitor_, *api_)); | ||
} | ||
|
||
private: | ||
Event::MockDispatcher dispatcher_; | ||
testing::NiceMock<ThreadLocal::MockInstance> tls_; | ||
Stats::IsolatedStoreImpl store_; | ||
Runtime::MockRandomGenerator generator_; | ||
Api::ApiPtr api_; | ||
testing::NiceMock<LocalInfo::MockLocalInfo> local_info_; | ||
Init::MockManager init_manager_; | ||
testing::NiceMock<ProtobufMessage::MockValidationVisitor> validation_visitor_; | ||
std::unique_ptr<Runtime::ScopedLoaderSingleton> loader_; | ||
}; | ||
|
||
} // namespace Envoy |