File tree Expand file tree Collapse file tree
config/components/apiserver-audit-logging
pkg/apis/identity/v1alpha1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,6 +142,14 @@ data:
142142 - group: "" # core API group
143143 resources: ["secrets", "configmaps"]
144144
145+ # Log MachineAccountKey at Metadata level to redact private key from audit logs
146+ # The privateKey is only returned in the response body on creation, so we omit
147+ # the response to prevent credential leakage in audit logs
148+ - level: Metadata
149+ resources:
150+ - group: "identity.miloapis.com"
151+ resources: ["machineaccountkeys"]
152+
145153 # Log Milo API resources at RequestResponse level to capture full context
146154 - level: RequestResponse
147155 resources:
Original file line number Diff line number Diff line change @@ -53,8 +53,9 @@ type MachineAccountKeyStatus struct {
5353 // persisted to etcd. Any value present on a GET or LIST response indicates a
5454 // bug in the server implementation.
5555 //
56- // Note: private key material will appear in API server audit logs for creation
57- // events. This matches the behavior of similar systems (GCP service account keys).
56+ // Note: The private key is NOT logged in API server audit logs. The audit policy
57+ // is configured to log MachineAccountKey resources at the Metadata level only,
58+ // which redacts the response body containing the private key.
5859 //
5960 // +kubebuilder:validation:Optional
6061 PrivateKey string `json:"privateKey,omitempty"`
You can’t perform that action at this time.
0 commit comments