127 Commits

Author SHA1 Message Date
Rishesh Agarwal
09218ae889 Adding layering_check and parse_headers in test files (#41226)
Closes #41226

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41226 from rishesh007:layering_test 02e735767f22e934850d5e150c5e3d577bdfbecb
PiperOrigin-RevId: 844606259
2025-12-14 23:05:28 -08:00
Craig Tiller
339906443b [clang-format] Match include file ordering to internal clang-format (#40905)
gRPC is currently getting formatted with two different clang-format implementations, and due to some weirdness they have different include file orderings. This change introduces clang-format configuration to ensure that the two systems align - it's *highly* expected that this will need some maintenance going forward as the two systems evolve.

Closes #40905

PiperOrigin-RevId: 819606209
2025-10-15 00:24:11 -07:00
Rishesh Agarwal
ecb1d4a9b7 This PR adds the missing dependencies src/core:grpc_check and :channel_arg_names to the relevant parts of the codebase
PiperOrigin-RevId: 814622149
2025-10-03 03:29:30 -07:00
Adam Heller
f5ffef4d6b [test] Add PostMortem dumps on CHECK failures in test builds (#39945)
See `grpc_check.h`. This code  redefines the abseil `CHECK*` macros using custom gRPC macros when building tests. In `bazel test ...` builds, on check failure, `PostMortemEmit()` will dump state to the log before crashing.

Caveat: to prevent circular dependencies, code that `postmortem` relies on cannot use the custom gRPC CHECK macros. This is not much code, ~50 source files. grep for the `absl/log:check` bazel dependency.

Closes #39945

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39945 from drfloob:grpc_check ca8e46718f2021e0df79aa67a3a0b0c751b3ce44
PiperOrigin-RevId: 807452496
2025-09-15 17:43:19 -07:00
Rishesh Agarwal
e2640c46d1 [build] Add Missing Dependencies for test/cpp/interop, test/cpp/server, test/cpp/thread_manager, test/cpp/util in Preparation for Enabling layering_check
PiperOrigin-RevId: 797690724
2025-08-21 03:36:51 -07:00
AJ Heller
ff8461db74 Begin moving gRPC socket_mutator files out of the iomgr folder
PiperOrigin-RevId: 792247693
2025-08-07 11:51:02 -07:00
Craig Tiller
12fcd268d4 Internal build cleanup
PiperOrigin-RevId: 732468670
2025-03-01 10:00:38 -08:00
Craig Tiller
66a137f1d7 [sanity] Restore it (#38869)
Closes #38869

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/38869 from ctiller:nubbins 972d734cdf45a4786de53c51b2ce8cf97a3d38ff
PiperOrigin-RevId: 731570368
2025-02-26 21:26:56 -08:00
Craig Tiller
07188632f4 Tiny formatting cleanups for portability
PiperOrigin-RevId: 731512282
2025-02-26 17:22:27 -08:00
Craig Tiller
684662351a Tag some internal build state
PiperOrigin-RevId: 731469422
2025-02-26 15:08:31 -08:00
Matthew Stevenson
4c7c1fa883 [tls] Provide more detailed error messages when validating credentials. (#38543)
Users of the TLS certificate provider were given the option to have validate their credentials at startup time in #37565, so that they can fail-fast. This is a small follow-up PR that provides finer-grained error messages in the event of a failure.

Closes #38543

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/38543 from matthewstevenson88:finer-grained-error-message bc6d6996e4e0726c73fa0dfb4bd71f5c63efb5a7
PiperOrigin-RevId: 720210228
2025-01-27 10:04:10 -08:00
Vignesh Babu
bcc04e7dbd [Orca Service] Gracefully fail the incoming RPC if it fails deserialization
PiperOrigin-RevId: 698420558
2024-11-20 09:39:37 -08:00
Mark D. Roth
55b1ae9700 [build] replace grpc_proto_library rules with separate proto_library/cc_proto_library/cc_grpc_library rules (#37943)
Closes #37943

PiperOrigin-RevId: 691538475
2024-10-30 13:45:41 -07:00
Nathan Baulch
b2a05bebe0 [maintenance] Fix cpp typos (#37755)
Continuation of #37541 but focused on C++.

Closes #37755

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37755 from NathanBaulch:typos-cpp 9a7fd9d65fa97a689d529772534df1a501031e9f
PiperOrigin-RevId: 684600898
2024-10-10 15:37:18 -07:00
Craig Tiller
dbb5164ac7 [clang-format] Remove custom clang-format rules for include ordering (#37820)
Closes #37820

PiperOrigin-RevId: 682352913
2024-10-04 09:44:20 -07:00
Matthew Stevenson
b87ed725df [tls] Add ValidateCredentials API to the TLS certificate provider. (#37565)
Add a ValidateCredentials API to the TLS certificate provider interface. A user can call this API to check that the credentials currently held by the certificate provider instance are valid. The definition of "valid" depends on provider that is being used. For the static data and file watcher providers, "valid" means that the credentials consist of valid PEM.

~Currently there is no check to ensure that credentials consist of valid PEM blocks before a TLS handshake commences. This PR creates a static factory for FileWatcherCertificateProvider (and marks the constructor as deprecated) which performs this validation check. The analogous work for StaticDataCertificateProvider will be done in a follow-up PR.~

Closes #37565

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37565 from matthewstevenson88:filewatcher f2232280232a9600cb32008597ed096352b65e34
PiperOrigin-RevId: 677847751
2024-09-23 10:27:06 -07:00
Mark D. Roth
f6c57b6384 [reorg] move a bunch of stuff to src/core/util (#36792)
The following files have been moved:
- src/core/lib/avl/*
- src/core/lib/backoff/*
- src/core/lib/debug/event_log*
- src/core/lib/iomgr/gethostname*
- src/core/lib/iomgr/grpc_if_nametoindex*
- src/core/lib/matchers/*
- src/core/lib/uri/* (renamed from uri_parser.* to uri.*)
- src/core/lib/gprpp/* (existing src/core/util/time.cc was renamed to gpr_time.cc to avoid conflict)

Closes #36792

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36792 from markdroth:reorg_util d4e8996f481c611ffbb06a8b04924ff81bc1bc2b
PiperOrigin-RevId: 676947640
2024-09-20 13:19:02 -07:00
Esun Kim
be26969058 [CI] Upgraded clang to 18 in sanity tests (#37593)
Closes #37593

PiperOrigin-RevId: 668971470
2024-08-29 09:52:31 -07:00
Tanvi Jagtap
986428d252 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36636)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log
In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future.

We have the following mapping

1. gpr_log(GPR_INFO,...) -> LOG(INFO)
2. gpr_log(GPR_ERROR,...) -> LOG(ERROR)
3. gpr_log(GPR_DEBUG,...) -> VLOG(2)

Reviewers need to check :

1. If the above mapping is correct.
2. The content of the log is as before.
gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected.

Closes #36636

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36636 from tanvi-jagtap:regex_test_cpp f2cac9c5a49f8d6025989160b9d9d6954dc8cc2d
PiperOrigin-RevId: 634954173
2024-05-17 20:10:09 -07:00
AJ Heller
bc5570bec8 Revert "[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - BUILD (#36607)" (#36625)
This reverts commit 15850972dd.

Breaks the bazel distribtests. https://source.cloud.google.com/results/invocations/da317d7c-5240-445f-8953-68a840ccc892/targets/%2F%2Ftools%2Fbazelify_tests%2Ftest:bazel_distribtest_6.5.0_buildtest/log

Closes #36625

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36625 from drfloob:revert-36607 395191f9c700e9b5206cef3bb44d875924602898
PiperOrigin-RevId: 633995522
2024-05-15 10:18:57 -07:00
Tanvi Jagtap
15850972dd [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - BUILD (#36607)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - BUILD
In this CL we are just editing the build and bzl files to add dependencies.
This is done to prevent merge conflict and constantly having to re-make the make files using generate_projects.sh for each set of changes.

Closes #36607

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36607 from tanvi-jagtap:build_test_cpp 3e17d778d03272cd51da86baa38b67f77760735c
PiperOrigin-RevId: 633523097
2024-05-14 03:37:04 -07:00
AJ Heller
c0208416b6 Automated rollback of commit 82e5116fb0.
PiperOrigin-RevId: 632241053
2024-05-09 12:54:02 -07:00
AJ Heller
82e5116fb0 Automated rollback of commit f45ac2c9e4.
PiperOrigin-RevId: 630539205
2024-05-03 17:30:40 -07:00
AJ Heller
f45ac2c9e4 Reland: [surface] Add an API to inject connected endpoints into servers
PiperOrigin-RevId: 630095574
2024-05-02 10:00:02 -07:00
Mark D. Roth
0944410d6c [reorg] move test/core/util -> test/core/test_util (#36446)
Closes #36446

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36446 from markdroth:reorg_test 5dcc85e006581a8fc52a3a914baa5f33e4a21589
PiperOrigin-RevId: 629229220
2024-04-29 17:06:40 -07:00
Tanvi Jagtap
30386413c0 [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36438)
[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT
Replacing GPR_ASSERT with absl CHECK

These changes have been made using string replacement and regex.

Will not be replacing all instances of CHECK with CHECK_EQ , CHECK_NE etc because there are too many callsites. Only ones which are doable using very simple regex with least chance of failure will be replaced.

Given that we have 5000+ instances of GPR_ASSERT to edit, Doing it manually is too much work for both the author and reviewer.

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36438

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36438 from tanvi-jagtap:tjagtap_cpp 405efd63c33aaef551368578c06d01eb85e2a629
PiperOrigin-RevId: 628281347
2024-04-25 21:03:38 -07:00
gRPC Team Bot
6dc64db1a8 Automated rollback of commit f61049f641.
PiperOrigin-RevId: 626062841
2024-04-18 09:43:26 -07:00
AJ Heller
f61049f641 [surface] Reland: Add an API to inject connected endpoints into servers
PiperOrigin-RevId: 625837807
2024-04-17 16:17:51 -07:00
Craig Tiller
b0cf42d86e [clang-format] Remove requirement that port_platform.h is at the top (#36281)
Closes #36281

PiperOrigin-RevId: 623176865
2024-04-09 08:58:34 -07:00
AJ Heller
798399b984 Automated rollback of commit 7c57fb70e9.
PiperOrigin-RevId: 622990471
2024-04-08 17:03:32 -07:00
AJ Heller
7c57fb70e9 [surface] Add an API to inject connected endpoints into servers (#35957)
Closes #35957

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35957 from drfloob:endpoint-infusion abdb9939c5bbed459182495f6272965aed8ecca8
PiperOrigin-RevId: 622939183
2024-04-08 13:42:57 -07:00
Luwei Ge
dd12460018 [tls] Add set min/max TLS version APIs to TLS credentials APIs. (#34861)
Address #28382. This is a recreation of #31368 except e2e tests are not handled here (yet).

Closes #34861

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/34861 from rockspore:tls_version f9a1215ac1291722dba4f22cedc128c241aa3cab
PiperOrigin-RevId: 589847110
2023-12-11 09:27:44 -08:00
Matthew Stevenson
07985907f2 [tls] Fix ownership bugs in TlsCredentialsOptions and grpc_tls_credentials_options. (#34758)
Currently it is very easy to use the `TlsCredentialsOptions` in such a
way that it produces a memory leak. For example, the code block
```
{
  TlsCredentialsOptions options;
}
```
produces a memory leak. This PR fixes up the ownership bugs in this
class and its `grpc_tls_credentials_options`, the C-core analogue.
2023-10-27 08:09:04 -07:00
Gregory Cooke
9969d820b5 [TLS - Revocation] Crl Provider (#34715)
This reverts commit 7af5efcfd3.
2023-10-19 11:33:41 -07:00
apolcyn
7af5efcfd3 Revert "[TLS - Revocation] Crl Provider (#33786)" (#34713)
This reverts commit 0f0396ae92.
2023-10-17 13:53:36 -07:00
Gregory Cooke
0f0396ae92 [TLS - Revocation] Crl Provider (#33786)
The basic APIs for the CRL Reloading features.
This adds external types to represent CRL Providers, CRLs, and
CertificateInfo.
Internally we will use `CrlImpl` - this layer is needed to hide OpenSSL
details from the user.

GRFC - https://github.com/grpc/proposal/pull/382

Things Done
* Add external API for `CrlProvider`, `Crl`, `CertInfo` (`CertInfo` is
used during CRL lookup rather than passing the entire certificate).
* Add code paths in `ssl_transport_security` to utilize CRL providers
* Add `StaticCrlProvider`
* Refactor `crl_ssl_transport_security_test.cc` so it is more extensible
and can be used with providers
2023-10-17 13:03:52 -04:00
Gregory Cooke
a4f345ff96 TlsCreds: Support revocation of intermediate in chain. (#32544)
This PR is a small code change with a lot of new test data.
[In OpenSSL, there are two flags that configure CRL checks. Coping
relevant
section:](https://www.openssl.org/docs/man1.0.2/man3/X509_VERIFY_PARAM_get_depth.html)

> - X509_V_FLAG_CRL_CHECK enables CRL checking for the certificate chain
leaf certificate. An error occurs if a suitable CRL cannot be found.
> - X509_V_FLAG_CRL_CHECK_ALL enables CRL checking for the entire
certificate chain.

We currently only set `X509_V_FLAG_CRL_CHECK`, so we will only ever
check if the leaf certificate is revoked. We should check the whole
chain. I am open to making this a user configuration if we want to do it
that way, but we certainly need to be able to check the whole chain.

So, this PR contains the small code change in
`ssl_transport_security.cc` to use the `X509_V_FLAG_CRL_CHECK_ALL` flag.
Then the rest of the changes are in tests. I've added all the necessary
files to have a chain built that looks as follows
`Root CA -> Revoked Intermediate CA -> Leaf Certificate`, and added a
test for this case as well.
You can verify that on master this new test will fail (i.e. the
handshake will succeed even though the intermediate CA is revoked) by
checking out this branch, running `git checkout master --
./src/core/tsi/ssl_transport_security.cc`, then running the test.

I also slightly reorganized test/core/tsi/test_creds/ so that the CRLs
are in their own directory, which is the way our API intends to accept
CRLs.
2023-03-23 11:34:59 -04:00
Yijie Ma
ac7faf75ba Fix a race on vptr for UnimplementedAsyncRequest (#32547)
It is reported in https://github.com/grpc/grpc/issues/32356 that there
is a race on vptr for `UnimplementedAsyncRequest` which would cause
crashes for multi-threaded server if clients send unimplemented RPC
request to the server.

The cause is that the server requests a call for
`UnimplementedAsyncRequest` in its base class `GenericAsyncRequest` when
the `vptr` still points to the base class's `vtable`. If the call went
in and another server thread picks up the tag before the `vptr` points
back to the derived class's `vtable`, it would call the wrong virtual
function and also this is a data race. This fix makes the request of the
call inside the derived class's constructor.

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-03-10 13:00:56 -08:00
Craig Tiller
67f364e23e [cleanup] Eliminate usage of GRPC_ASSERT(false...); (#31757)
* crash function

* progress

* fix

* fix

* Automated change: Fix sanity tests

* fix

* fix

* fix

* fixes

* Automated change: Fix sanity tests

* fix

* Automated change: Fix sanity tests

* fix

* fix

* use cpp attr

* Automated change: Fix sanity tests

* fix

* fix

* fix

* fix

* fix

* fix

* add exclusion

* fix

* typo

* fix

* fmt

* Update tcp_socket_utils.cc

* Automated change: Fix sanity tests

* fix

* revert php changes

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-01-11 08:50:32 -08:00
Yijie Ma
f99b8b5bc4 Convert c-style comments to C++-style comments (#31923)
* baseline

* fix clang-tidy

* manually revert these files

* manually fixup at eof

* revert 2 more files

* change check_deprecated_grpc++.py

* change end2end_defs.include template

* fix check_include_guards.py

* untrack tools/distrib/python/convert_cstyle_comments_to_cpp.py

not yet ready to be submitted

* fix

yapf check_include_guards.py
remove a space...

* fix version.cc.template

* fix version_info.h.template
2022-12-22 23:01:53 -08:00
Cheng-Yu Chung
ac365cadfb Remove include/grpc/impl/codegen/port_platform.h (#31778) 2022-12-14 10:46:33 +08:00
Esun Kim
0ba0c4bf74 Added googletest clang-tidy checks (#31610)
* Added google-googletest

* Autofix

* Fix test names

* Fix
2022-11-18 13:02:20 -08:00
Esun Kim
660a6f281e Added readability-redundant-string-init (#31609)
* Added readability-redundant-string-init

* Fix
2022-11-10 11:14:36 -08:00
Esun Kim
530b702259 Update Clang 15 (#31518)
* clang-15

* iwyu

* run clang_format_code

* Clang-Tidy config

* Fix misc-unused-using-decls

* Fixed performance-inefficient-vector-operation

* Sanity
2022-11-04 09:08:03 -07:00
Yash Tibrewal
5f6c357e74 Move some targets from //: to //src/core: (#31402)
* temp

* temp

* temp

* top BUILD builds

* everything builds

* buildify

* temp fix_build_deps change

* fix gpr_atm

* additional changes

* fix build files

* nofixdeps

* Generate projects

* json_args

* fix context

* Generate projects

* Sprinkle some avoid_dep tags

* Run fix_build_deps

* Remove additional avoid_dep

* Revert some targets

* grpc_mock_cel
2022-10-20 20:12:53 -07:00
Cheng-Yu Chung
a192f155b9 Remove include/grpcpp/impl/codegen/config.h (#31061)
* Remove `include/grpcpp/impl/codegen/config.h`

* Update
2022-10-06 13:14:16 -04:00
Craig Tiller
9c98d67d7a [c++14] absl::make_unique --> std::make_unique (#31159)
* [c++14] absl::make_unique --> std::make_unique

* fix

* fix
2022-09-29 06:45:17 -07:00
Craig Tiller
b463cabeec Update flaky tests (#30873)
* Update flaky tests list

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2022-09-07 10:16:34 -07:00
Craig Tiller
f573fd44f9 [test] Semi-automatic flaky test tracking (#30638)
* [test] Semi-automatic flaky test tracking

* fix

* Automated change: Fix sanity tests

* Update update_flakes.py

* fix formatting

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2022-08-19 16:22:31 -07:00
Craig Tiller
05e6bf2e4a [build] Add test/core/util, test/core/event_engine to auto build deps (#30364)
* [build] Add test/core/util, test/core/event_engine to auto build deps

* deal with suppressions

* fix suppressions

* Automated change: Fix sanity tests

* fix

* fix

* fix

* fix

* progress

* Automated change: Fix sanity tests

* fix

* fix

* fix

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2022-07-25 21:59:25 -07:00