tl;dr: it is now possible to specify required rights on handles in FIDL files
Hi Team,
Handle rights can now be specified in FIDL files and be validated (along with object type) in all FIDL bindings. Rights annotations help to improve security by better aligning expectations with reality.
RFC-0028 provides more details on the motivation.
Okay, I’m excited. How can I use it?
Rights can be specified as an optional second parameter on handles:
If the rights parameter is omitted, the rights are zx.rights.SAME_RIGHTS.
Client and server ends have object type CHANNEL and rights zx.DEFAULT_CHANNEL_RIGHTS.
Very cool. But, where are all of the rights defined?
Rights are defined as a bits in the zx library in //zircon/vdso/rights.fidl. In addition to the rights bits definition, this file contains constants defining sets of bits, like zx.RIGHTS_BASIC.
That makes sense - could you explain the ‘|’?
| is the bitwise OR operator for FIDL bits. This works on all bits, not just rights.
I’m a details person. Could you explain the object type and rights checks more?
Sure. Identical object type and rights checks happen in the sending and receiving directions.
Suppose a FIDL field has required rights R and a handle h is sent in it:
It is an error for h to be missing rights that are present in R. The channel will be closed.
If h has more rights than R, its rights are reduced to R through zx_handle_replace.
Additionally, it is an error for a handle to be sent not matching the type specified in the FIDL file, resulting in channel closure.
And this is ready now?! I have many use cases in mind!
Yes, this is ready today. Please consider it for new and existing APIs.
If you have further questions, don’t hesitate to reach out to fidl...@fuchsia.net
tl;dr: it is now possible to specify required rights on handles in FIDL files
Hi Team,
After 1 frozening and 1.5 years, handle rights can now be specified in FIDL files and be validated (along with object type) in all FIDL bindings. Rights annotations help to improve security by better aligning expectations with reality.