Skip to content

Extensions apiserver allocation endpoint reachable without Kubernetes RBAC #4572

@adilburaksen

Description

@adilburaksen

Summary

The Agones extensions apiserver (agones-controller-service:443/apis/allocation.agones.dev/v1/...) serves as a Kubernetes aggregated APIService. When Kubernetes routes allocation requests through the API server aggregator, the aggregator enforces authn/authz normally. However, the same service port is directly reachable within the cluster as a standard Service endpoint.

The extensions HTTPS server (pkg/util/https/server.go) configures TLS with GetCertificate only — no ClientAuth, no RequestHeader CA verification, no bearer-token authentication, and no SubjectAccessReview before dispatching to resource handlers. pkg/util/apiserver/apiserver.go routes /apis/<groupVersion>/namespaces/ directly to CRDHandler delegates without any authorization middleware.

As a result, any in-cluster workload that can reach agones-controller-service on port 443 can POST a GameServerAllocation directly, bypassing Kubernetes RBAC for the aggregated resource.

Affected files

  • pkg/util/https/server.go — TLS config lacks ClientAuth / RequestHeader CA
  • pkg/util/apiserver/apiserver.go — no auth middleware before resource dispatch
  • cmd/extensions/main.go — extension server shares the webhook mux without auth

Expected fix

Implement Kubernetes aggregation layer authentication on the extension HTTPS server:

  • Load extension-apiserver-authentication ConfigMap from kube-system
  • Configure ClientAuth: VerifyClientCertIfGiven with the RequestHeader CA
  • Verify the proxy client certificate CN against requestheader-allowed-names

The controller service account already has system:auth-delegator and extension-apiserver-authentication-reader bindings, which suggests this authentication was intended but not yet implemented.

Note

This issue was first surfaced in PR #4557 (closed for code quality). This issue is to discuss the right implementation approach before a fix PR is opened.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/securityIssues pertaining to securityhelp wantedWe would love help on these issues. Please come help us!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions