Skip to content

Commit 47ff0e5

Browse files
committed
fix: link assigned name in activity create summaries for generateName
Activity create summaries linked audit.objectRef.name, which is empty for resources created with generateName (the assigned name lives in responseObject.metadata.name). Reading audit.objectRef.name errored with "no such key: name", so the activity was never produced and the create was silently missing from the user's activity feed. Confirmed in production for Connector (create rule) and Domain (update rule). Key changes: - Connector, ConnectorAdvertisement, TrafficProtectionPolicy, BackendTLSPolicy, Gateway: create-rule summaries link responseObject.metadata.name. Update rules are unchanged — objectRef.name is always present on updates. - Domain: guard the requestObject.spec and spec.domainName path segments before linking the domain name, on both create and update rules. Claude-Session: https://claude.ai/code/session_01KnYuL5Pf1R5ysZoxxNkKiu
1 parent b1eded2 commit 47ff0e5

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 {{ has(audit.requestObject.spec) && has(audit.requestObject.spec.domainName) ? link(audit.requestObject.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 {{ has(audit.requestObject.spec) && has(audit.requestObject.spec.domainName) ? link(audit.requestObject.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)