feat(audit): wire AddAuditEmission into 9 services (AUDIT-002)

- Wire StellaOps.Audit.Emission DI in: Authority, Policy, Release-Orchestrator,
  EvidenceLocker, Notify, Scanner, Scheduler, Integrations, Platform
- Add AuditEmission__TimelineBaseUrl to compose defaults
- Endpoint filter annotation deferred to follow-up pass

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-08 16:20:39 +03:00
parent 65106afe4c
commit f5a9f874d0
34 changed files with 1865 additions and 24 deletions

View File

@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using StellaOps.Audit.Emission;
using StellaOps.Auth.Abstractions;
using StellaOps.Localization;
using StellaOps.Auth.ServerIntegration;
@@ -280,6 +281,9 @@ builder.Services.AddEndpointsApiExplorer();
builder.Services.AddStellaOpsLocalization(builder.Configuration);
builder.Services.AddTranslationBundle(System.Reflection.Assembly.GetExecutingAssembly());
// Unified audit emission (posts audit events to Timeline service)
builder.Services.AddAuditEmission(builder.Configuration);
// Stella Router integration
var routerEnabled = builder.Services.AddRouterMicroservice(
builder.Configuration,

View File

@@ -181,7 +181,10 @@ internal static class ScheduleEndpoints
SchedulerEndpointHelpers.ResolveActorId(httpContext),
now,
SchedulerEndpointHelpers.ResolveActorId(httpContext),
SchedulerSchemaVersions.Schedule);
SchedulerSchemaVersions.Schedule,
source: request.Source ?? "user",
jobKind: request.JobKind ?? "scan",
pluginConfig: request.PluginConfig);
await repository.UpsertAsync(schedule, cancellationToken: cancellationToken).ConfigureAwait(false);
await auditService.WriteAsync(
@@ -366,7 +369,7 @@ internal static class ScheduleEndpoints
enabled: false,
existing.CronExpression,
existing.Timezone,
existing.Mode,
existing.Mode,
existing.Selection,
existing.OnlyIf,
existing.Notify,
@@ -377,7 +380,9 @@ internal static class ScheduleEndpoints
now,
SchedulerEndpointHelpers.ResolveActorId(httpContext),
existing.SchemaVersion,
existing.Source);
existing.Source,
jobKind: existing.JobKind,
pluginConfig: existing.PluginConfig);
await repository.UpsertAsync(updated, cancellationToken: cancellationToken).ConfigureAwait(false);
await auditService.WriteAsync(
@@ -454,7 +459,9 @@ internal static class ScheduleEndpoints
now,
SchedulerEndpointHelpers.ResolveActorId(httpContext),
existing.SchemaVersion,
existing.Source);
existing.Source,
jobKind: existing.JobKind,
pluginConfig: existing.PluginConfig);
await repository.UpsertAsync(updated, cancellationToken: cancellationToken).ConfigureAwait(false);
await auditService.WriteAsync(
@@ -512,6 +519,8 @@ internal static class ScheduleEndpoints
var notify = request.Notify ?? existing.Notify;
var limits = request.Limits ?? existing.Limits;
var subscribers = request.Subscribers ?? existing.Subscribers;
var jobKind = request.JobKind ?? existing.JobKind;
var pluginConfig = request.PluginConfig ?? existing.PluginConfig;
return new Schedule(
existing.Id,
@@ -531,7 +540,9 @@ internal static class ScheduleEndpoints
updatedAt,
actor,
existing.SchemaVersion,
existing.Source);
existing.Source,
jobKind: jobKind,
pluginConfig: pluginConfig);
}
}

View File

@@ -24,6 +24,7 @@
<ProjectReference Include="../../Router/__Libraries/StellaOps.Messaging/StellaOps.Messaging.csproj" />
<ProjectReference Include="../../Router/__Libraries/StellaOps.Router.AspNet/StellaOps.Router.AspNet.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Localization/StellaOps.Localization.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Audit.Emission/StellaOps.Audit.Emission.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Translations\*.json" />