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

Add null checks to generated GRPC API #2455

Merged
merged 1 commit into from
Dec 9, 2022
Merged

Conversation

daschl
Copy link
Contributor

@daschl daschl commented Dec 7, 2022

Motivation:

At the moment the generated GRPC code does not perform input validation in all necessary methods and might pass invalid/null inputs down into the GRPC layer where it is harder to track down what went wrong in the first place.

Modifications:

This changeset adds explicit requireNonNull to all generated methods which accept user input and adds a test case to verify that the requireNonNull is performed at the earliest point in time and not deeper in the call stack.

Result:

Early argument null checks to improve debugability in case of invalid argument values.

Motivation:

At the moment the generated GRPC code does not perform input validation
in all necessary methods and might pass invalid/null inputs
down into the GRPC layer where it is harder to track down what
went wrong in the first place.

Modifications:

This changeset adds explicit requireNonNull to all generated methods
which accept user input and adds a test case to verify that the
requireNonNull is performed at the earliest point in time and
not deeper in the call stack.

Result:

Early argument null checks to improve debugability in case of
invalid argument values.
Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@daschl daschl merged commit e83c645 into apple:main Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants