services/internal/binarylib: bug fix: Create call on existing binary resets ACLs

Because Create's implementation first set the ACLs and then checks if the binary
already exists, calling Create on a name corresponding to an existing binary
ends up resetting the ACLs for the binary. This gives ownership of the object to
the caller of the second Create (and overwriting any explicit ACL settings done
after the first Create). This was detected in production, where we occasionally
called "device publish" for the same binary (proxyd) twice during the same
second.

This CL swaps the ordering of operations in Create, first setting up the
directory corresponding to the new binary, and, only if it turns out that the
object is indeed new, setting the ACLs.  To prevent unauthorized access to the
object after it's created but before ACLs are set, we restrict the authorizer to
only allow Create calls against objects without permissions set on them.

Change-Id: I4788143ed739c4006e286fe36833ed0cf7a51fcf
6 files changed
tree: 6aa4951268cce3dad698f612ffc5707fd4662756
  1. cmd/
  2. examples/
  3. internal/
  4. lib/
  5. runtime/
  6. services/
  7. test/
  8. .gerrit_commit_message
  9. .gitignore
  10. AUTHORS
  11. CONTRIBUTORS
  12. envvar.go
  13. envvar_test.go
  14. LICENSE
  15. PATENTS
  16. README.md
  17. VERSION
README.md

Vanadium

This repository contains a reference implementation of the Vanadium APIs.

Unlike the APIs in https://github.com/vanadium/go.v23, which promises to provide backward compatibility this repository makes no such promises.