Share secrets with a team
Keep a team's secrets in its group's vault, so access follows the group's membership with nothing to hand over.
API
A team’s credentials belong to the team, not to whoever happened to write them. Kept in the group’s vault, they are sealed under the group’s own key: every member reads and writes them, someone who joins the group reads what the others wrote, and someone who leaves is refused from their next request.
Before you start: a realm administrator, holding RealmOwner or a privilege of your own that allows changing
groups, creates the group and manages its members; the members then keep the secrets, with no privilege of their own. Each call is made with the caller’s own session in $CVYUH_SESSION (Call the API shows
how).
Keep the team’s secrets
Section titled “Keep the team’s secrets”-
As a realm administrator, create the
engineeringgroup:Terminal window curl "https://foobar.cvyuh.com/api/v0/am/objects/v1/group?id=engineering" \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "displayName": "Engineering" }'The realm answers
201with the group and its revision,rev. -
Add
mayaandbenas members, one call each, with the group’s currentrev:Terminal window curl https://foobar.cvyuh.com/api/v0/am/objects/v1/group/engineering/relationships/member \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-H 'If-Match: "<rev>"' \-d '{ "targetId": "maya" }' -
As
maya, write a team secret:Terminal window curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/group/engineering/data/deploy/key \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "data": { "key": "<deploy key>" } }'The first member to open the group’s vault makes the group’s key.
-
As
ben, read it:Terminal window curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/group/engineering/data/deploy/key \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"
Check it worked
Section titled “Check it worked”Someone not in the group who tries the same read is refused (403). Every member can also give
grants on the group’s secrets, for someone outside the team who needs one.
Undo it
Section titled “Undo it”To take ben off the team, a realm administrator removes him from the group, with the group’s current rev:
curl -X DELETE https://foobar.cvyuh.com/api/v0/am/objects/v1/group/engineering/relationships/member/ben \ -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \ -H 'If-Match: "<rev>"'He is refused from his next request. What he already read stays with him: write new values for every secret in the group’s vault he used, and change the credential where it is used. If he was the last to write a secret that has grants on it and is later deleted, writing it again also restarts those grants.
Related
Section titled “Related”- Group keys: how the group’s key works.
- Vaults: what members may do.
- Give someone access to a secret: one secret, for someone outside the team.