Commit Graph

31 Commits

Author SHA1 Message Date
markb74 746501dff6
binder: SecurityPolicy updates (take 2). (#8637)
The previous attempt at this CL relied on guava's Hashing class which
is still in beta. This update compares Signature objects directly instead
of SHA256 hashs, removing the need for the Hashing class.

Add additional comments to the security policy class, to mention that
implementing new policies requires significant care.

With that in mind, add security policies to check the peer app's
signature, so people can create cross-app communication without
having to implement their own policy.

Finally, add the UntrustedSecurityPolicies class, since that's
inevitably a policy which is sometimes needed.
2021-11-01 18:57:30 +01:00
markb74 14eb3b265f
Support BinderChannelBuilder.forTarget. (#8633)
Allows this class to be used with custom name resolvers.
2021-11-01 14:01:56 +01:00
Eric Anderson ee395e0e43 Revert "binder: SecurityPolicy updates. (#8632)"
This reverts commit 997592192b.

Hashing is a Beta API in Guava, so we can't use it as-is.
2021-10-28 13:18:14 -07:00
markb74 997592192b
binder: SecurityPolicy updates. (#8632)
Add additional comments to the security policy class, to mention that implementing new policies requires significant care.

Also add security policies which check the Sha256 of a peer apps's signature, so people can do trusted cross-app communication without having to implement their own policy.

Finally, add the UntrustedSecurityPolicies class, since that's inevitably a policy you sometimes need as well.
2021-10-28 11:30:43 +02:00
markb74 9266174812
Fix code & javadoc warnings in the binder package. (#8588)
Note: I didn't fix all javadoc warnings mentioned in #8585, since
they're not generated with a modern java version, and the fix feels
worse than the warning.

Specifically, {@link X.Y} generates a warning if only X is imported,
and {@link Z} generates a warning if Z is declared later in the class.

In particular, attempting to fix the first issue by importing X.Y results
in a code-readability warning suggesting I shouldn't do that.
2021-10-09 12:27:01 +02:00
markb74 0d25d8f7d6
Publish binder in releases. (#8585) 2021-10-08 12:03:44 +02:00
ZHANG Dapeng 2e84b0f20a
android: bump min Android SDK version to 19 (#8583)
As Google Play Service [discontinued updates for Jelly Bean (API levels 16, 17 & 18)](https://android-developers.googleblog.com/2021/07/google-play-services-discontinuing-jelly-bean.html).
2021-10-06 10:02:32 -07:00
markb74 fcc7b9694e
Add LifecycleOnDestroyHelper to support shutdown of channel/server on Android lifecycle changes (#8568) 2021-09-29 20:04:47 +02:00
John Cormie 3ff23d3684
Synchronize access to acknowledgedOutgoingBytes/transmitWindowFull. (#8547)
Fixes #8536
2021-09-22 12:19:48 -07:00
John Cormie 46dbac3eb6
Make manifest usable with android_instrumentation_test()s in google3 (#8545) 2021-09-22 11:53:16 -07:00
markb74 e244065b0c
Fix flakey security policy tests. (#8550)
Using ShadowProcess to set the processes uID doesn't help since SecurityPolicies class fetches the ID in a static initializer, and it may have already been loaded.

Instead, just rely on whatever the uID is already, and ensure the other UIDs we test with are offset from that first value.
2021-09-22 19:19:10 +02:00
Eric Anderson 7942f35c47 binder: Disable flaky SecurityPolicy tests
Not using `@Ignore` because the tests can probably run successfully
under Bazel.

See #8391
2021-08-06 12:20:39 -07:00
ZHANG Dapeng 1833587597
binder: fix binder build (#8366)
The binder module fail to compile because in #8355, the class BinderClientTransportTest was not refactored correspondingly.
2021-08-02 15:54:55 -07:00
ZHANG Dapeng 860e97d12a
all: API refactoring in preparation to support retry stats (#8355)
Rebased PR #8343 into the first commit of this PR, then (the 2nd commit) reverted the part for metric recording of retry attempts. The PR as a whole is mechanical refactoring. No behavior change (except that some of the old code path when tracer is created is moved into the new method `streamCreated()`).

The API change is documented in go/grpc-stats-api-change-for-retry-java
2021-07-31 18:33:02 -07:00
markb74 5e18ff208a
Run binderchannel android tests. (#8306) 2021-07-14 13:10:28 +02:00
markb74 eb802cf6b1
Add an asAndroidAppUri() method to AndroidComponentAddress. (#8312)
This returns the address as an "android-app://" uri, which can be
used with AndroidAppNameResolverProvider.
2021-07-14 11:01:07 +02:00
Eric Anderson dd2a422193 binder: Remove unused import 2021-07-08 09:48:43 -05:00
markb74 d4ecc7cdb4
More exposed APIs to support internal transition. (#8303)
All maked with Internal to make it clear these APIs shouldn't
be used normally.
2021-07-05 13:12:49 +02:00
John Cormie 380f26fd8d
Inform the server of the client's deadline using the standard header. (#8286) 2021-07-02 18:31:50 +02:00
markb74 06d34925f9
binder: Updates to support migrations to this API from internal versions. (#8299) 2021-07-02 12:53:47 +02:00
John Cormie 66faf105dd
Fix BinderSecurityTests that would always pass due to empty 'methods' map (#8287) 2021-06-25 22:15:08 +02:00
John Cormie c092d94255
Update AndroidComponentAddress to wrap a binding Intent. (#8275)
By considering this Intent's action, data, type, identity and categories
we align gRPC/Binder's addressing with Android's natural equivalence
relation for "cached" IBinders.
2021-06-24 13:38:06 +02:00
Eric Anderson 5642e01243
Replace failOnVersionConflict() with custom requireUpperBoundDeps
failOnVersionConflict has never been good for us. It is equivalent to
Maven dependencyConvergence which we discourage our users to use because
it is too tempermental and _creates_ version skew issues over time.
However, we had no real alternative for determining if our deps would be
misinterpeted by Maven.

failOnVersionConflict has been a constant drain and makes it really hard
to do seemingly-trivial upgrades. As evidenced by protobuf/build.gradle
in this change, it also caused _us_ to introduce a version downgrade.

This introduces our own custom requireUpperBoundDeps implementation so
that we can get back to simple dependency upgrades _and_ increase our
confidence in a consistent dependency tree.
2021-06-11 14:01:18 -07:00
markb74 b846ae79bb
Allow SecurityPolicy definitions. (#8254)
Internally this was package visible to retain strict control
over the available policies. However, that kind of strict control
doesn't work with the open-source version, since users will want
to create their own policies. There's at least google-specific
policy internally.
2021-06-11 18:02:36 +02:00
markb74 0c723f7ca9
binder: Server and Channel Builders for BinderChannel. (#8218)
binder: Server and Channel Builders for BinderChannel.

Also adds 3 additional tests.
2021-06-07 19:39:20 +02:00
markb74 1cd925c3dd
Remove InternalMetadataHelper. (#8209)
This class wasn't really necessary.
2021-06-02 11:03:29 +02:00
markb74 f88d362bc7
Fix the use of scheduler pools in BinderServer. (#8210)
Switch to using scheduled pools in BinderServer.
2021-05-27 13:37:22 +02:00
markb74 8e18c11bbd
binder: BinderTransport implementation. (#8031)
This is the first major code drop for binderchannel, containing the transport class and its internals.
2021-05-26 14:54:32 +02:00
Chengyuan Zhang f33658a6d7
Migrate away from Jcenter (#8111)
Replaces jcenter with mavenCentral.
2021-04-22 15:59:36 -07:00
markb74 9fc32f1bc9
binder: Add LeakSafeOneWayBinder and tests. (#8021)
Another util class, this one with tests which need to run on
an Android emulator.
2021-03-31 17:39:10 +01:00
markb74 c6d48f7cb1
binder: Some basic binderchannel util code (#7796)
This just adds the ServiceBinding class and
BindServiceFlags, internal utils.

Most binderchannel code relies heavily on Java8 features,
so I'm keeping that requirement, since grpc-java plans to
require Java8 eventually anyway.
2021-03-24 15:40:11 -07:00