Repository navigation
feat(policy): store and deliver team policy - #127
Merged
Merged
Conversation
… at boot Production already ran version 66 (pending_invitation_role_ids). The migrator now ignores applied versions this build lacks so a rollback image still boots.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Teams can now store one policy document on the server (Business). It uses the same format as the machine
policy.json(locks and$rangelimits, no defaults), and members receive it inGET /v1/teams. No client uses it yet; the client PR follows. Part of VoltiusApp/voltius#757.What changes:
teams.policy(jsonb),policy_revision,policy_updated_atandpolicy_updated_by. It copies every existing lock policy into the document assecurity.lockTimeoutMinutes: {"$range": {"max": N}}plussecurity.lockAction: "vault"when vault lock is forced. The migration can be run twice safely, and the same copy also runs at every boot.GET,PUTandDELETE /v1/teams/:id/policy.PUTreplaces the whole document and needs the currentrevision. A stale revision gets 409POLICY_REVISION_MISMATCH.$rangeshape, no defaults. It refuses machine-only keys (server.*,enrollment.token,plugins.install) with 400 and names the key.PUTis allowed only when it removes keys, andDELETEis always allowed.team.policy_set(with the added, changed and removed keys) andteam.policy_removed, and every member getsteam_members:<team>.lock_*columns.GET /v1/teamsbuildslock_policyfrom the document for shipped clients, and addspolicy,policy_revisionandjoined_at.set_ignore_missing). An image from before a newer migration can therefore still boot after a rollback.Tests: full suite in Docker, 836 passed.
Deploy note: production runs sha-ad25887 (migration 066). This image applies 067 at boot. It only adds columns and copies existing lock policies, so it is short on a small table.