Scope the secrets_manager policy to explicit paths

What does this MR do?

Notes for reviewers
  • Release: merging is fine, but per gitlab-org/gitlab!262091 (comment 4158621210) the quota rule from https://gitlab.com/gitlab-org/gitlab/-/work_items/638270 should be added before this ships in a GitLab chart release, so new installs don't need a root token to get it later
  • The canonical copy is ee/lib/secrets_management/secrets_manager_policy.hcl in gitlab-org/gitlab, now on master. This copy must match it byte for byte, and it does as of 068ed693. Nothing checks that yet (#49 (closed)), and testing caught one comment that had drifted
  • Removing sudo alone does not fix this: with path "*" the token can rewrite its own policy and give sudo back
  • Tested: helm lint, helm unittest (101/101, the new assertions fail on main values), and the rendered policy is byte-identical to the Rails file
  • A fresh helm install of an earlier revision of this branch on GKE self-initialized OpenBao with this policy, and the privileged JWT was denied sys/raw, sys/seal, sys/audit and the crafted root paths. The current sys/* and identity/* denies were tested on a throwaway OpenBao and GDK, not GKE
  • A fresh install with no recovery key can still create one with recovery_key:store, use it to generate a root token, and give the Rails role more permissions later. Tested on a throwaway OpenBao that started with this policy
  • sys/* and identity/* are denied because the +/+/+/ rules also matched paths like sys/policy/... and identity/group/name/..., which let the token write a root policy, attach it to itself and rewrite secrets_manager

Author's Checklist

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Ensure a release milestone is set.
  • MR title and description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • MR has a green pipeline on GitLab.com.
  • When ready for review, MR is labeled workflowready for review per the MR workflow.

Expected

  • Test plan indicating conditions for success has been posted and passes.
  • Documentation is created or updated.
  • Tests are added.
Edited by Jayakrishnan Mallissery

Merge request reports

Loading
Loading