Skip to content

Commit 4e43bf8

Browse files
committed
fix: link assigned name in activity create summaries for generateName
Activity summaries dereferenced audit fields that are not always present, so activity generation failed silently and creates went missing from the user's activity feed. Confirmed in production for Connector (create) and Domain (update). Two distinct causes: - generateName creates have no objectRef.name; the assigned name lives in responseObject.metadata.name. Reading objectRef.name errored with "no such key: name". - Domain's domainName is required and immutable, so updates/patches omit it from the request body; requestObject.spec.domainName is absent on updates. Key changes: - Connector, ConnectorAdvertisement, TrafficProtectionPolicy, BackendTLSPolicy, Gateway: create-rule summaries link responseObject.metadata.name. Update rules unchanged — objectRef.name is always present on updates. - Domain: create and update summaries link responseObject.spec.domainName (the stored object always carries it), matching the existing delete rule. Claude-Session: https://claude.ai/code/session_01KnYuL5Pf1R5ysZoxxNkKiu
1 parent b1eded2 commit 4e43bf8

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

config/milo/activity/policies/backendtlspolicy-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
# BackendTLSPolicy creation with spec available
1818
- name: create
1919
match: "!audit.user.username.startsWith('system:') && audit.verb == 'create' && has(audit.requestObject.spec)"
20-
summary: "{{ actor }} created backend TLS policy {{ link(audit.objectRef.name, audit.objectRef) }}"
20+
summary: "{{ actor }} created backend TLS policy {{ link(audit.responseObject.metadata.name, audit.objectRef) }}"
2121

2222
# BackendTLSPolicy creation fallback (no spec)
2323
- name: create-fallback

config/milo/activity/policies/connector-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
# Connector creation with spec available
1818
- name: create
1919
match: "!audit.user.username.startsWith('system:') && audit.verb == 'create' && has(audit.requestObject.spec)"
20-
summary: "{{ actor }} created connector {{ link(audit.objectRef.name, audit.objectRef) }}"
20+
summary: "{{ actor }} created connector {{ link(audit.responseObject.metadata.name, audit.objectRef) }}"
2121

2222
# Connector creation fallback (no spec)
2323
- name: create-fallback

config/milo/activity/policies/connectoradvertisement-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
# ConnectorAdvertisement creation with spec available
1919
- name: create
2020
match: "!audit.user.username.startsWith('system:') && audit.verb == 'create' && has(audit.requestObject.spec)"
21-
summary: "{{ actor }} created connector advertisement {{ link(audit.objectRef.name, audit.objectRef) }}"
21+
summary: "{{ actor }} created connector advertisement {{ link(audit.responseObject.metadata.name, audit.objectRef) }}"
2222

2323
# ConnectorAdvertisement creation fallback (no spec)
2424
- name: create-fallback

config/milo/activity/policies/domain-policy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
# Domain creation with spec.domainName available - use domain name as display text
1919
- name: create
2020
match: "!audit.user.username.startsWith('system:') && audit.verb == 'create' && has(audit.requestObject.spec)"
21-
summary: "{{ actor }} created domain {{ link(audit.requestObject.spec.domainName, audit.objectRef) }}"
21+
summary: "{{ actor }} created domain {{ link(audit.responseObject.spec.domainName, audit.objectRef) }}"
2222

2323
# Domain creation fallback (no spec)
2424
- name: create-fallback
@@ -38,7 +38,7 @@ spec:
3838
# Domain update with spec available - excludes status subresource
3939
- name: update
4040
match: "!audit.user.username.startsWith('system:') && audit.verb in ['update', 'patch'] && !has(audit.objectRef.subresource) && has(audit.requestObject.spec)"
41-
summary: "{{ actor }} updated domain {{ link(audit.requestObject.spec.domainName, audit.objectRef) }}"
41+
summary: "{{ actor }} updated domain {{ link(audit.responseObject.spec.domainName, audit.objectRef) }}"
4242

4343
# Domain update fallback (no spec)
4444
- name: update-fallback

config/milo/activity/policies/gateway-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
# Gateway creation with spec available
1818
- name: create
1919
match: "!audit.user.username.startsWith('system:') && audit.verb == 'create' && has(audit.requestObject.spec)"
20-
summary: "{{ actor }} created gateway {{ link(audit.objectRef.name, audit.objectRef) }}"
20+
summary: "{{ actor }} created gateway {{ link(audit.responseObject.metadata.name, audit.objectRef) }}"
2121

2222
# Gateway creation fallback (no spec)
2323
- name: create-fallback

config/milo/activity/policies/trafficprotectionpolicy-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
# TrafficProtectionPolicy creation with spec available
1818
- name: create
1919
match: "!audit.user.username.startsWith('system:') && audit.verb == 'create' && has(audit.requestObject.spec)"
20-
summary: "{{ actor }} created traffic protection policy {{ link(audit.objectRef.name, audit.objectRef) }}"
20+
summary: "{{ actor }} created traffic protection policy {{ link(audit.responseObject.metadata.name, audit.objectRef) }}"
2121

2222
# TrafficProtectionPolicy creation fallback (no spec)
2323
- name: create-fallback

0 commit comments

Comments
 (0)