CommitStatuses are globally resolved by the controller, this means it is possible to have a CommitStatus in one namespace be used for a PromotionStrategy in a different namespace. If a CommitStatus key and sha matches the list of keys in the PromotionStrategy as well as the commit sha it will be used. This could be useful for distributed teams, say different teams authoring microservices in different namespaces, to coordinate deployments.
Note though there is no authentication or opt-in to this process, as long as the CommitStatus matches the key and sha, neither of which is considered sensitive, it will get used. At first glance this doesn't appear to be a major security issue since the worse a bad actor could do is block a deployment.
However it's conceivable that someone could author a matching (on key and sha) imposter commit status and through a race condition trigger a promotion of a change. If the same bad actor had managed to get access to the git repository and author a commit on the DRY branch they could potentially leverage this to promote an attack across clusters.
While this can feel like a bit of a stretch, given the bad actor needs access to the cluster to make it work, it illustrates one possible problem and where one problem exists there could be others.
In general in Kubernetes when items need to be globally resolved they are cluster-scoped whereas CommitStatus is namespace scoped. While this behaviour is implied in the docs via a note (https://gitops-promoter.readthedocs.io/en/latest/gating-promotions/), it is neither intuitive nor obvious to users and I know for me it was a bit of a surprise.
In terms of solutions there are a couple of possible solutions that came out of some brief discussion @crenshaw-dev:
- Stop resolving CommitStatus globally and only resolve them locally, this would require CommitStatus to always be in the same namespace as PromotionStrategy.
- Same as 1 but if a globally required CommitStatus is required then add support for a ClusterCommitStatus that is cluster scoped. The challenge here is most regular tenants on a cluster don't have access to cluster scoped resources so these cluster scoped CommitStatus resources would likely require the Platform team to manage them rather then tenants. Additionally the user created CommitStatuses (ArgoCDCommitStatus, WebRequestCommitStatus, etc) would need to have cluster scoped equivalents as well.
- Add an opt-in mechanism to PromotionStrategy, similar to Argo CD Apps-In-Any-Namespaces, where the PromotionStrategy specifies the namespaces from which CommitStatuses can be contributed.
CommitStatuses are globally resolved by the controller, this means it is possible to have a CommitStatus in one namespace be used for a PromotionStrategy in a different namespace. If a CommitStatus
keyandshamatches the list of keys in the PromotionStrategy as well as the commitshait will be used. This could be useful for distributed teams, say different teams authoring microservices in different namespaces, to coordinate deployments.Note though there is no authentication or opt-in to this process, as long as the CommitStatus matches the key and sha, neither of which is considered sensitive, it will get used. At first glance this doesn't appear to be a major security issue since the worse a bad actor could do is block a deployment.
However it's conceivable that someone could author a matching (on
keyandsha) imposter commit status and through a race condition trigger a promotion of a change. If the same bad actor had managed to get access to the git repository and author a commit on the DRY branch they could potentially leverage this to promote an attack across clusters.While this can feel like a bit of a stretch, given the bad actor needs access to the cluster to make it work, it illustrates one possible problem and where one problem exists there could be others.
In general in Kubernetes when items need to be globally resolved they are cluster-scoped whereas CommitStatus is namespace scoped. While this behaviour is implied in the docs via a note (https://gitops-promoter.readthedocs.io/en/latest/gating-promotions/), it is neither intuitive nor obvious to users and I know for me it was a bit of a surprise.
In terms of solutions there are a couple of possible solutions that came out of some brief discussion @crenshaw-dev: