feat(secrets-ui): add metadata filtering and private reveal outcomes
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Condition="'$(SecretsUiPackageVersion)' == ''" Include="../../../../../../ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/ZB.MOM.WW.Secrets.Ui.csproj" />
|
||||
<PackageReference Condition="'$(SecretsUiPackageVersion)' != ''" Include="ZB.MOM.WW.Secrets.Ui" Version="$(SecretsUiPackageVersion)" />
|
||||
<PackageReference Include="ZB.MOM.WW.Theme" Version="1.0.0" />
|
||||
<PackageReference Include="ZB.MOM.WW.Theme" Version="1.0.1" />
|
||||
<Compile Include="../shared/*.cs" Link="%(Filename)%(Extension)" />
|
||||
<Compile Include="../../../../../../ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/FakeCipher.cs" Link="Fakes/FakeCipher.cs" />
|
||||
<Compile Include="../../../../../../ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/RecordingSecretStore.cs" Link="Fakes/RecordingSecretStore.cs" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><base href="/" />
|
||||
|
||||
<ThemeHead /><title>Secrets synthetic acceptance fixture</title>
|
||||
<link rel="stylesheet" href="/fixture-bootstrap/bootstrap.min.css" /><ThemeHead /><title>Secrets synthetic acceptance fixture</title>
|
||||
<style>body{margin:0}.fixture-main{padding:1.5rem;max-width:92rem;margin:auto;min-width:0}.fixture-note{font-size:.85rem;color:var(--ink-muted)}.fixture-transform{transform:translateZ(0)}.visually-hidden{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}</style>
|
||||
<HeadOutlet /></head><body><div class="fixture-main fixture-transform"><p class="fixture-note">Synthetic local fixture · perpage · No production data or services</p>
|
||||
<Routes /></div><ThemeScripts /><script src="/_framework/blazor.web.js"></script></body></html>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Condition="'$(SecretsUiPackageVersion)' == ''" Include="../../../../../../ZB.MOM.WW.Secrets/src/ZB.MOM.WW.Secrets.Ui/ZB.MOM.WW.Secrets.Ui.csproj" />
|
||||
<PackageReference Condition="'$(SecretsUiPackageVersion)' != ''" Include="ZB.MOM.WW.Secrets.Ui" Version="$(SecretsUiPackageVersion)" />
|
||||
<PackageReference Include="ZB.MOM.WW.Theme" Version="1.0.0" />
|
||||
<PackageReference Include="ZB.MOM.WW.Theme" Version="1.0.1" />
|
||||
<Compile Include="../shared/*.cs" Link="%(Filename)%(Extension)" />
|
||||
<Compile Include="../../../../../../ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/FakeCipher.cs" Link="Fakes/FakeCipher.cs" />
|
||||
<Compile Include="../../../../../../ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Ui.Tests/Fakes/RecordingSecretStore.cs" Link="Fakes/RecordingSecretStore.cs" />
|
||||
|
||||
@@ -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