fix: audit target is the record acted on, never a typed username; guard retention
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
81ef54f996
commit
7aa5c4b921
10 files changed
+61
-7
No files matched your search
+1
-1
@@ -94,7 +94,7 @@ public class PubSubConfig {
|
||||
Subscription request = Subscription.newBuilder()
|
||||
.setTopic(PROJECTS_PREFIX + projectId + TOPICS_PREFIX + auditEventTopic)
|
||||
.setName(PROJECTS_PREFIX + projectId + SUBSCRIPTIONS_PREFIX + auditEventSubscription)
|
||||
.setRetainAckedMessages(true)
|
||||
.setRetainAckedMessages(false) // audit payloads carry actors and IPs: keep them only in audit_event
|
||||
.setExpirationPolicy(ExpirationPolicy.newBuilder().setTtl(com.google.protobuf.Duration.newBuilder().setSeconds(31536000)).build())
|
||||
.build();
|
||||
subscriptionAdminClient.createSubscription(request);
|
||||
|
||||
+2
@@ -20,6 +20,8 @@ public class AuditEventLogPurge {
|
||||
public AuditEventLogPurge(AuditEventLogRepository repository,
|
||||
@Value("${audit.retention-days:${AUDIT_RETENTION_DAYS:730}}") int retentionDays) {
|
||||
this.repository = repository;
|
||||
// 0 or less would delete the whole trail at the next run: refuse to start instead.
|
||||
if (retentionDays < 1) throw new IllegalArgumentException("audit.retention-days must be at least 1");
|
||||
this.retentionDays = retentionDays;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user