agent-substrate / agent-substrate/substrate

Over-Privileged GKE Nodes via Default Compute Engine Service Account in `setup-gcp bootstrap`

Aberta
#1,468 1 comentário 1 reação 0 responsáveis Ver no GitHub
area/dev-infra area/security kind/bug
Linguagem predominante
Go
Estrelas
1.8k
Forks
316
Merge médio
2d 43min
PRs com merge (30d)
287

Descrição

Reported by @gooleg-gh

> Summary
> K8s nodes in the cluster created by setup-gcp bootstrap command uses default compute service account and grants additional permissions to it. This gap is mentioned in the [documentation](https://github.com/agent-substrate/substrate/blob/e1adb331471a8b246c837a376bb166f7efa6cd30/tools/setup-gcp/README.md#what-create-iam-actually-grants) and in the [code](https://github.com/agent-substrate/substrate/blob/40884c148875985ab08f7e342b8ff29361310c1b/tools/setup-gcp/cmd/iam.go#L68) with a TODO comment.
>
> Recommended mitigation: Use [custom node service account](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/service-accounts#node-service-accounts) with minimal permissions instead.
>
> PoC
>
> Run the setup-gcp bootstrap command and observe the default compute service account used in the created GKECluster→MIG→InstanceTemplate.
>
> Impact
> Low risk security issue.
>
> Compute default service account tends to accumulate permissions used in different contexts. If GKE node with that DCSA is compromised, the threat actor will gain unnecessarily broad permissions granted to the default service account.
>
> All customers who rely on the setup-gcp bootstrap for initial GKE cluster setup are affected.

The actual permissions we need to grant to the node service account are roles/artifactRegistry.reader, so that the node can pull the Substrate container images that are built.

This is only needed for the development case, where you are building the container images and uploading them to your own private container registry.

For "normal" installs, presumably you would instead be pointing at some public container images published by the Substrate project, and this is moot.

I'd say concrete actions here are:

* Ensure that the GKE clusters we create use a dedicated node service account (this is just good hygiene)
* Once the install scripts support a "install from local checkout" vs "install from published images" distinction, we can make the permission grant conditional on "install from local checkout"

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.