Loading
Scope the secrets_manager policy to explicit paths
What does this MR do?
- Part of the fix for https://gitlab.com/gitlab-org/cloud-native/charts/openbao/-/work_items/36, done in public per https://gitlab.com/gitlab-org/cloud-native/charts/openbao/-/work_items/36#note_4003135718
- The
secrets_managerpolicy that self-init creates grants every capability, includingsudo, on every path, so the privileged GitLab Rails JWT is equivalent to a root token - This MR replaces it with explicit allow rules for the paths Rails calls, plus deny rules for the root namespace paths that the
+/+/+/tenant rules would otherwise also match - New installs only. Self-init runs once, so existing installs keep their policy until an admin runs the Rails
gitlab:secrets_management:openbao:secrets_manager_policy:updateRake task, merged in gitlab-org/gitlab!262091 (merged) - Bumps the chart to
1.0.0, its first major release now that Secrets Manager is GA
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.hclingitlab-org/gitlab, now onmaster. This copy must match it byte for byte, and it does as of068ed693. Nothing checks that yet (#49 (closed)), and testing caught one comment that had drifted - Removing
sudoalone does not fix this: withpath "*"the token can rewrite its own policy and givesudoback - Tested:
helm lint,helm unittest(101/101, the new assertions fail onmainvalues), and the rendered policy is byte-identical to the Rails file - A fresh
helm installof an earlier revision of this branch on GKE self-initialized OpenBao with this policy, and the privileged JWT was deniedsys/raw,sys/seal,sys/auditand the crafted root paths. The currentsys/*andidentity/*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/*andidentity/*are denied because the+/+/+/rules also matched paths likesys/policy/...andidentity/group/name/..., which let the token write a root policy, attach it to itself and rewritesecrets_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.
Related issues
Edited by Jayakrishnan Mallissery