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

Automated fix for refs/heads/local_creds #19

Open
wants to merge 8 commits into
base: local_creds
Choose a base branch
from
Open
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
52 changes: 52 additions & 0 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions build_autogenerated.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/BUILD
Original file line number Diff line number Diff line change
@@ -4069,9 +4069,9 @@ grpc_cc_library(
"//:promise",
"//:ref_counted_ptr",
"//:sockaddr_utils",
"//src/core:experiments",
"//:tsi_base",
"//:uri_parser",
"//src/core:experiments",
],
)

2 changes: 1 addition & 1 deletion src/core/lib/experiments/experiments.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/core/lib/experiments/experiments.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -149,7 +149,8 @@ void local_check_peer(tsi_peer peer, grpc_endpoint* ep,
if (grpc_core::IsLocalConnectorSecureEnabled()) {
switch (type) {
case UDS:
security_level = tsi_security_level_to_string(TSI_PRIVACY_AND_INTEGRITY);
security_level =
tsi_security_level_to_string(TSI_PRIVACY_AND_INTEGRITY);
break;
default:
security_level = tsi_security_level_to_string(TSI_SECURITY_NONE);
Original file line number Diff line number Diff line change
@@ -119,7 +119,9 @@ def test_propagation_to_auth_plugin(self):
composite_credentials = grpc.composite_channel_credentials(
local_credentials, call_credentials
)
with grpc.secure_channel(f"unix:{uds_path}", composite_credentials) as channel:
with grpc.secure_channel(
f"unix:{uds_path}", composite_credentials
) as channel:
stub = channel.unary_unary(
grpc._common.fully_qualified_method(
_SERVICE_NAME, _UNARY_UNARY
4 changes: 2 additions & 2 deletions test/core/end2end/end2end_tests.h
Original file line number Diff line number Diff line change
@@ -684,9 +684,9 @@ class CoreEnd2endTestRegistry {
GTEST_SKIP() << "Disabled for initial v3 testing"; \
}

#define SKIP_IF_LOCAL_CREDS() \
#define SKIP_IF_LOCAL_CREDS() \
if (GetParam()->feature_mask & FEATURE_MASK_IS_LOCAL_CREDS) { \
GTEST_SKIP() << "Disabled for Local TCP Connection"; \
GTEST_SKIP() << "Disabled for Local TCP Connection"; \
}

#define CORE_END2END_TEST(suite, name) \
4 changes: 2 additions & 2 deletions test/core/end2end/tests/call_creds.cc
Original file line number Diff line number Diff line change
@@ -264,15 +264,15 @@ CORE_END2END_TEST(PerCallCredsOnInsecureTest,
}

CORE_END2END_TEST(PerCallCredsTest, RequestResponseWithPayloadAndCallCreds) {
if (grpc_core::IsLocalConnectorSecureEnabled()) {
if (IsLocalConnectorSecureEnabled()) {
SKIP_IF_LOCAL_CREDS();
}
TestRequestResponseWithPayloadAndCallCreds(*this, true);
}

CORE_END2END_TEST(PerCallCredsTest,
RequestResponseWithPayloadAndOverriddenCallCreds) {
if (grpc_core::IsLocalConnectorSecureEnabled()) {
if (IsLocalConnectorSecureEnabled()) {
SKIP_IF_LOCAL_CREDS();
}
TestRequestResponseWithPayloadAndOverriddenCallCreds(*this, true);
69 changes: 30 additions & 39 deletions test/core/security/local_security_connector_test.cc
Original file line number Diff line number Diff line change
@@ -18,53 +18,40 @@

#include <gtest/gtest.h>

#include <grpc/impl/grpc_types.h>

#include "src/core/client_channel/client_channel_filter.h"
#include "src/core/lib/security/context/security_context.h"
#include "src/core/tsi/transport_security.h"
#include "test/core/test_util/test_config.h"
#include "src/core/client_channel/client_channel_filter.h"
#include "include/grpc/impl/grpc_types.h"

namespace grpc_core {
namespace testing {
namespace {

absl::string_view GetLocalUnixAddress(grpc_endpoint* /*ep*/) {
return "unix:";
}
absl::string_view GetLocalUnixAddress(grpc_endpoint* /*ep*/) { return "unix:"; }

const grpc_endpoint_vtable kUnixEndpointVtable = {nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
GetLocalUnixAddress,
nullptr,
nullptr};
const grpc_endpoint_vtable kUnixEndpointVtable = {
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, GetLocalUnixAddress,
nullptr, nullptr};

absl::string_view GetLocalTcpAddress(grpc_endpoint* /*ep*/) {
return "ipv4:127.0.0.1:12667";
}

const grpc_endpoint_vtable kTcpEndpointVtable = {nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
GetLocalTcpAddress,
nullptr,
nullptr};
const grpc_endpoint_vtable kTcpEndpointVtable = {
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, GetLocalTcpAddress,
nullptr, nullptr};

void CheckSecurityLevelForServer(grpc_local_connect_type connect_type,
tsi_security_level level,
grpc_endpoint ep) {
grpc_server_credentials* server_creds = grpc_local_server_credentials_create(connect_type);
tsi_security_level level, grpc_endpoint ep) {
grpc_server_credentials* server_creds =
grpc_local_server_credentials_create(connect_type);
ChannelArgs args;
RefCountedPtr<grpc_server_security_connector> connector = server_creds->
create_security_connector(args);
RefCountedPtr<grpc_server_security_connector> connector =
server_creds->create_security_connector(args);
ASSERT_NE(connector, nullptr);
tsi_peer peer;
CHECK(tsi_construct_peer(0, &peer) == TSI_OK);
@@ -82,14 +69,14 @@ void CheckSecurityLevelForServer(grpc_local_connect_type connect_type,
grpc_server_credentials_release(server_creds);
}

static void CheckSecurityLevelForChannel(grpc_local_connect_type connect_type,
tsi_security_level level,
grpc_endpoint ep) {
grpc_channel_credentials* channel_creds = grpc_local_credentials_create(connect_type);
void CheckSecurityLevelForChannel(grpc_local_connect_type connect_type,
tsi_security_level level, grpc_endpoint ep) {
grpc_channel_credentials* channel_creds =
grpc_local_credentials_create(connect_type);
ChannelArgs args;
args = args.Set((char*) GRPC_ARG_SERVER_URI, (char*) "unix:");
RefCountedPtr<grpc_channel_security_connector> connector = channel_creds->
create_security_connector(nullptr, "unix:", &args);
args = args.Set((char*)GRPC_ARG_SERVER_URI, (char*)"unix:");
RefCountedPtr<grpc_channel_security_connector> connector =
channel_creds->create_security_connector(nullptr, "unix:", &args);
ASSERT_NE(connector, nullptr);
tsi_peer peer;
CHECK(tsi_construct_peer(0, &peer) == TSI_OK);
@@ -115,7 +102,9 @@ TEST(LocalSecurityConnectorTest, CheckSecurityLevelOfUdsConnectionServer) {
}

TEST(LocalSecurityConnectorTest, SecurityLevelOfTcpConnectionServer) {
if (!grpc_core::IsLocalConnectorSecureEnabled()) {return;}
if (!IsLocalConnectorSecureEnabled()) {
return;
}
grpc_endpoint ep;
ep.vtable = &kTcpEndpointVtable;
CheckSecurityLevelForServer(LOCAL_TCP, TSI_SECURITY_NONE, ep);
@@ -128,7 +117,9 @@ TEST(LocalSecurityConnectorTest, CheckSecurityLevelOfUdsConnectionChannel) {
}

TEST(LocalSecurityConnectorTest, SecurityLevelOfTcpConnectionChannel) {
if (!grpc_core::IsLocalConnectorSecureEnabled()) {return;}
if (!IsLocalConnectorSecureEnabled()) {
return;
}
grpc_endpoint ep;
ep.vtable = &kTcpEndpointVtable;
CheckSecurityLevelForChannel(LOCAL_TCP, TSI_SECURITY_NONE, ep);
24 changes: 24 additions & 0 deletions tools/run_tests/generated/tests.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.