grpc / grpc/grpc-java

binder: A Server might check its SecurityPolicy even after declaring termination

Open
#12,938 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

### What version of gRPC-Java are you using?
master/HEAD on any version of Android

### What did you expect to see?
Some reasoning/guarantee that a `BinderServerTransport` will no longer call into its SecurityPolicy after it declares termination.

### Steps to reproduce the bug
One of many ways is to call call `shutdownNow()` while it's processing the first call to one of its services.

### Analysis
`BinderServerTransport` has this problem when using either `AsyncSecurityPolicy` or ordinary `SecurityPolicy`. It checks these policies from the `BinderTransportSecurity.ServerAuthInterceptor` which runs on the server's `executor()` without coordination or synchronization with the transport. A call to `shutdownInternal()` w/`forceTerminate=true` can move the transport to `SHUTDOWN_TERMINATED` and call `ServerTransportListener#transportTerminated` with streams still in-flight.

Contributor guide

Open the contributing guide

Research direction

Trace BinderServerTransport.shutdownInternal(), BinderTransportSecurity.ServerAuthInterceptor, and the transport executor to understand how termination overlaps security-policy checks. Check the ServerTransportListener#transportTerminated path and the forceTerminate case; done means the behavior is defined and verified for both AsyncSecurityPolicy and ordinary SecurityPolicy after shutdownNow().

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
backend-api-design, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.