Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add connection requested server name attribute to TCP read filter" #1844

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions include/istio/control/http/check_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class CheckData {
// Returns true if connection is mutual TLS enabled.
virtual bool IsMutualTLS() const = 0;

// Get requested server name, SNI in case of TLS
virtual std::string GetRequestedServerName() const = 0;

// These headers are extracted into top level attributes.
// This is for standard HTTP headers. It supports both HTTP/1.1 and HTTP2
// They can be retrieved at O(1) speed by environment (Envoy).
Expand Down
3 changes: 0 additions & 3 deletions include/istio/control/tcp/check_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ class CheckData {
// Returns true if connection is mutual TLS enabled.
virtual bool IsMutualTLS() const = 0;

// Get requested server name, SNI in case of TLS
virtual std::string GetRequestedServerName() const = 0;

// Get downstream tcp connection id.
virtual std::string GetConnectionId() const = 0;
};
Expand Down
1 change: 0 additions & 1 deletion include/istio/utils/attribute_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ struct AttributeName {
static const char kConnectionSendTotalBytes[];
static const char kConnectionDuration[];
static const char kConnectionMtls[];
static const char kConnectionRequestedServerName[];
static const char kConnectionId[];
// Record TCP connection status: open, continue, close
static const char kConnectionEvent[];
Expand Down
8 changes: 0 additions & 8 deletions src/envoy/http/mixer/check_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ std::map<std::string, std::string> CheckData::GetRequestHeaders() const {

bool CheckData::IsMutualTLS() const { return Utils::IsMutualTLS(connection_); }

std::string CheckData::GetRequestedServerName() const {
if (connection_) {
return std::string(connection_->requestedServerName());
}

return "";
}

bool CheckData::FindHeaderByType(HttpCheckData::HeaderType header_type,
std::string* value) const {
switch (header_type) {
Expand Down
1 change: 0 additions & 1 deletion src/envoy/http/mixer/check_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class CheckData : public ::istio::control::http::CheckData,
std::map<std::string, std::string> GetRequestHeaders() const override;

bool IsMutualTLS() const override;
std::string GetRequestedServerName() const override;

bool FindHeaderByType(
::istio::control::http::CheckData::HeaderType header_type,
Expand Down
4 changes: 0 additions & 4 deletions src/envoy/tcp/mixer/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ bool Filter::IsMutualTLS() const {
return Utils::IsMutualTLS(&filter_callbacks_->connection());
}

std::string Filter::GetRequestedServerName() const {
return std::string(filter_callbacks_->connection().requestedServerName());
}

bool Filter::GetDestinationIpPort(std::string* str_ip, int* port) const {
if (filter_callbacks_->upstreamHost() &&
filter_callbacks_->upstreamHost()->address()) {
Expand Down
1 change: 0 additions & 1 deletion src/envoy/tcp/mixer/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class Filter : public Network::Filter,
bool GetSourceIpPort(std::string* str_ip, int* port) const override;
bool GetSourceUser(std::string* user) const override;
bool IsMutualTLS() const override;
std::string GetRequestedServerName() const override;

// ReportData virtual functions.
bool GetDestinationIpPort(std::string* str_ip, int* port) const override;
Expand Down
6 changes: 0 additions & 6 deletions src/istio/control/http/attributes_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,6 @@ void AttributesBuilder::ExtractCheckAttributes(CheckData *check_data) {
builder.AddBool(utils::AttributeName::kConnectionMtls,
check_data->IsMutualTLS());

std::string requested_server_name = check_data->GetRequestedServerName();
if (!requested_server_name.empty()) {
builder.AddString(utils::AttributeName::kConnectionRequestedServerName,
requested_server_name);
}

builder.AddTimestamp(utils::AttributeName::kRequestTime,
std::chrono::system_clock::now());

Expand Down
10 changes: 0 additions & 10 deletions src/istio/control/http/attributes_builder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ attributes {
bool_value: true
}
}
attributes {
key: "connection.requested_server_name"
value {
string_value: "www.google.com"
}
}
attributes {
key: "source.principal"
value {
Expand Down Expand Up @@ -292,8 +286,6 @@ TEST(AttributesBuilderTest, TestCheckAttributes) {
EXPECT_CALL(mock_data, IsMutualTLS()).WillOnce(Invoke([]() -> bool {
return true;
}));
EXPECT_CALL(mock_data, GetRequestedServerName())
.WillOnce(testing::Return("www.google.com"));
EXPECT_CALL(mock_data, GetRequestHeaders())
.WillOnce(Invoke([]() -> std::map<std::string, std::string> {
std::map<std::string, std::string> map;
Expand Down Expand Up @@ -349,8 +341,6 @@ TEST(AttributesBuilderTest, TestCheckAttributesWithAuthNResult) {
EXPECT_CALL(mock_data, IsMutualTLS()).WillOnce(Invoke([]() -> bool {
return true;
}));
EXPECT_CALL(mock_data, GetRequestedServerName())
.WillOnce(testing::Return("www.google.com"));
EXPECT_CALL(mock_data, GetRequestHeaders())
.WillOnce(Invoke([]() -> std::map<std::string, std::string> {
std::map<std::string, std::string> map;
Expand Down
1 change: 0 additions & 1 deletion src/istio/control/http/mock_check_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class MockCheckData : public CheckData {
MOCK_CONST_METHOD1(GetAuthenticationResult,
bool(istio::authn::Result *result));
MOCK_CONST_METHOD0(IsMutualTLS, bool());
MOCK_CONST_METHOD0(GetRequestedServerName, std::string());
};

// The mock object for HeaderUpdate interface.
Expand Down
6 changes: 0 additions & 6 deletions src/istio/control/tcp/attributes_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ void AttributesBuilder::ExtractCheckAttributes(CheckData* check_data) {
builder.AddBool(utils::AttributeName::kConnectionMtls,
check_data->IsMutualTLS());

std::string requested_server_name = check_data->GetRequestedServerName();
if (!requested_server_name.empty()) {
builder.AddString(utils::AttributeName::kConnectionRequestedServerName,
requested_server_name);
}

builder.AddTimestamp(utils::AttributeName::kContextTime,
std::chrono::system_clock::now());
builder.AddString(utils::AttributeName::kContextProtocol, "tcp");
Expand Down
8 changes: 0 additions & 8 deletions src/istio/control/tcp/attributes_builder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ attributes {
bool_value: true
}
}
attributes {
key: "connection.requested_server_name"
value {
string_value: "www.google.com"
}
}
attributes {
key: "source.principal"
value {
Expand Down Expand Up @@ -311,8 +305,6 @@ TEST(AttributesBuilderTest, TestCheckAttributes) {
return true;
}));
EXPECT_CALL(mock_data, GetConnectionId()).WillOnce(Return("1234-5"));
EXPECT_CALL(mock_data, GetRequestedServerName())
.WillOnce(Return("www.google.com"));

RequestContext request;
AttributesBuilder builder(&request);
Expand Down
1 change: 0 additions & 1 deletion src/istio/control/tcp/mock_check_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class MockCheckData : public CheckData {
MOCK_CONST_METHOD2(GetSourceIpPort, bool(std::string* ip, int* port));
MOCK_CONST_METHOD1(GetSourceUser, bool(std::string* user));
MOCK_CONST_METHOD0(IsMutualTLS, bool());
MOCK_CONST_METHOD0(GetRequestedServerName, std::string());
MOCK_CONST_METHOD0(GetConnectionId, std::string());
};

Expand Down
3 changes: 0 additions & 3 deletions src/istio/utils/attribute_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ const char AttributeName::kConnectionSendTotalBytes[] =
"connection.sent.bytes_total";
const char AttributeName::kConnectionDuration[] = "connection.duration";
const char AttributeName::kConnectionMtls[] = "connection.mtls";
const char AttributeName::kConnectionRequestedServerName[] =
"connection.requested_server_name";

// Downstream TCP connection id.
const char AttributeName::kConnectionId[] = "connection.id";
const char AttributeName::kConnectionEvent[] = "connection.event";
Expand Down