feat(secrets-ui): add metadata filtering and private reveal outcomes
This commit is contained in:
@@ -13,7 +13,7 @@ internal sealed class SyntheticAuthentication(NavigationManager navigation) : Au
|
||||
return Task.FromResult(new AuthenticationState(SyntheticIdentity.ForRole(role)));
|
||||
}
|
||||
}
|
||||
internal sealed record FaultSettings(bool List = false, bool Write = false, bool Audit = false, int DelayMs = 0);
|
||||
internal sealed record FaultSettings(bool List = false, bool Write = false, bool Audit = false, int DelayMs = 0, int ReadDelayMs = 0);
|
||||
|
||||
internal static class SyntheticIdentity
|
||||
{
|
||||
|
||||
@@ -19,9 +19,9 @@ builder.Services.AddScoped<AuthenticationStateProvider, SyntheticAuthentication>
|
||||
var store = new RecordingSecretStore();
|
||||
var cipher = new FakeCipher();
|
||||
var audit = new CapturingAuditWriter();
|
||||
foreach (string name in new[] { "app/alpha", "app/bravo", "app/" + new string('x', 160) })
|
||||
store.Seed(cipher.Encrypt(new SecretName(name), "synthetic-fixture-value", SecretContentType.Text) with
|
||||
{ Description = "Illustrative local metadata", UpdatedBy = "synthetic-reviewer", UpdatedUtc = DateTimeOffset.Parse("2026-11-13T12:00:00Z") });
|
||||
foreach (string name in new[] { "app/alpha", "app/bravo", "app/" + new string('x', 400) })
|
||||
store.Seed(cipher.Encrypt(new SecretName(name), name.Length > 100 ? new string('s', 800) : "synthetic-fixture-value", SecretContentType.Text) with
|
||||
{ Description = "Illustrative local metadata", KekId = name.Length > 100 ? "synthetic-kek-" + new string('k', 100) : "fake-kek", UpdatedBy = name.Length > 100 ? "synthetic-reviewer-" + new string('u', 100) : "synthetic-reviewer", UpdatedUtc = DateTimeOffset.Parse("2026-11-13T12:00:00Z") });
|
||||
builder.Services.AddSingleton<ISecretStore>(store);
|
||||
builder.Services.AddSingleton<ISecretCipher>(cipher);
|
||||
builder.Services.AddSingleton<IAuditWriter>(audit);
|
||||
@@ -39,10 +39,11 @@ app.MapPost("/fixture/faults", (FaultSettings faults) =>
|
||||
store.DeleteFault = faults.Write ? new IOException("synthetic delete outage") : null;
|
||||
audit.SuccessFault = faults.Audit ? new IOException("synthetic audit outage") : null;
|
||||
int delay = Math.Clamp(faults.DelayMs, 0, 10000);
|
||||
store.BeforeGetAsync = (_, ct) => Task.Delay(Math.Clamp(faults.ReadDelayMs, 0, 10000), ct);
|
||||
store.UpsertOverride = (_, ct) => Task.Delay(delay, ct);
|
||||
store.DeleteOverride = (_, _, ct) => Task.Delay(delay, ct);
|
||||
return Results.NoContent();
|
||||
});
|
||||
app.MapGet("/fixture/counts", () => new { lists = store.ListCalls, upserts = store.Upserts.Count, deletes = store.Deletes.Count, audits = audit.Events.Select(e => new { e.Action, e.Target, e.DetailsJson, e.Outcome }) });
|
||||
app.MapGet("/fixture/counts", () => new { gets = store.Gets.Count, lists = store.ListCalls, upserts = store.Upserts.Count, deletes = store.Deletes.Count, audits = audit.Events.Select(e => new { e.Action, e.Target, e.DetailsJson, e.Outcome }) });
|
||||
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user