Decision history
diff --git a/ui/Bower.Management.Web/src/pages/PackInstallApprovals.tsx b/ui/Bower.Management.Web/src/pages/PackInstallApprovals.tsx
new file mode 100644
index 00000000..8d429a36
--- /dev/null
+++ b/ui/Bower.Management.Web/src/pages/PackInstallApprovals.tsx
@@ -0,0 +1,169 @@
+import { CheckCircle2, KeyRound } from "lucide-react";
+import { useState } from "react";
+import { useApi } from "../api";
+import { EmptyState, ResourceState } from "../components/ui";
+import { useResource } from "../hooks/useResource";
+import { formatDate } from "../lib/format";
+import type { Access, PackInstallRequestRecord } from "../types";
+
+export function PackInstallApprovals({ access, canApprove }: { access: Access | null; canApprove: boolean }) {
+ const [refresh, setRefresh] = useState(0);
+ const requests = useResource
("/api/packs/install-requests", refresh);
+
+ return (
+
+
+
Pack installation requests
+ Two people: one asks, another decides
+
+
+ {(items) => {
+ const pending = Array.isArray(items)
+ ? items.filter((item) => item.status === "pending-review")
+ : [];
+ return pending.length ? (
+
+ {pending.map((item) => (
+
setRefresh((value) => value + 1)}
+ />
+ ))}
+
+ ) : (
+ }
+ title="No pack installs waiting"
+ detail="When someone requests a pack install from the Packs page, it waits here for another person's decision."
+ />
+ );
+ }}
+
+
+ );
+}
+
+function PackInstallApprovalCard({
+ item,
+ access,
+ canApprove,
+ onDecided
+}: {
+ item: PackInstallRequestRecord;
+ access: Access | null;
+ canApprove: boolean;
+ onDecided: () => void;
+}) {
+ const api = useApi();
+ const [reason, setReason] = useState("");
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState(null);
+ const own = access !== null && access.objectId === item.requestedByObjectId;
+
+ async function decide(action: "approve" | "reject") {
+ if (!reason.trim()) {
+ setError("Enter a reason before recording the decision.");
+ return;
+ }
+ setBusy(true);
+ setError(null);
+ try {
+ await api(`/api/packs/install-requests/${encodeURIComponent(item.id)}/${action}`, {
+ method: "POST",
+ body: JSON.stringify({ reason: reason.trim() })
+ });
+ onDecided();
+ } catch (decisionError) {
+ setError(decisionError instanceof Error ? decisionError.message : "Decision failed.");
+ } finally {
+ setBusy(false);
+ }
+ }
+
+ return (
+
+
+
+ {item.packName} v{item.packVersion} → {item.targetEnvironment ?? item.targetCollectorId}
+
+
+
+
Asked for by
+
+ {item.requestedByName}, {formatDate(item.requestedAt)}
+
+
+
+
Reason
+ {item.reason}
+
+
+
Signed key / Pack hash
+
+ {item.signedByKeyId} · {item.packHash.slice(0, 12)}
+
+
+
+
Population diff
+
+ {item.diff.affectedCollectors.length} collector
+ {item.diff.affectedCollectors.length === 1 ? "" : "s"} · {item.diff.eventTypesAdded.join(", ")}
+
+
+
+
+ {!canApprove ? (
+
+
+
+ Viewing only. Bower.Approver or Bower.Administrator is required to decide.
+
+
+ ) : own ? (
+
+
+
You requested this pack install, so another approver must decide it.
+
+ ) : (
+
+ )}
+
+ );
+}
diff --git a/ui/Bower.Management.Web/src/pages/PacksPage.test.tsx b/ui/Bower.Management.Web/src/pages/PacksPage.test.tsx
new file mode 100644
index 00000000..eeae5428
--- /dev/null
+++ b/ui/Bower.Management.Web/src/pages/PacksPage.test.tsx
@@ -0,0 +1,200 @@
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { MemoryRouter } from "react-router-dom";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { App } from "../App";
+import { AuthenticationProvider } from "../auth";
+import type { PackGalleryResponse, PackInstallRequestRecord } from "../types";
+
+const galleryFixture: PackGalleryResponse = {
+ configured: true,
+ trustedKeyCount: 1,
+ packs: [
+ {
+ trusted: true,
+ fileName: "linux-ssh-gateway-1.0.0.bowerpack",
+ id: "linux-ssh-gateway",
+ version: "1.0.0",
+ name: "Linux SSH Gateway",
+ description: "Captures SSH authentication successes and failures.",
+ owner: "platform-security",
+ builtAtUtc: "2026-11-20T00:00:00Z",
+ packHash: "abcdef0123456789abcdef0123456789",
+ signedByKeyId: "key-prod-1",
+ eventTypes: ["auth.ssh.failed", "auth.ssh.succeeded"],
+ policies: [
+ {
+ id: "ssh-auth",
+ version: "1.0.0",
+ action: "accept",
+ eventTypes: ["auth.ssh.failed", "auth.ssh.succeeded"],
+ hash: "111122223333"
+ }
+ ],
+ redactions: ["Default Australian privacy policy."],
+ detectionCount: 1,
+ parserCount: 1,
+ sampleResults: [
+ {
+ name: "ssh-failed-login",
+ passed: true,
+ expectedDecision: "accept",
+ actualDecision: "accept",
+ problems: []
+ }
+ ],
+ refusalReason: null
+ },
+ {
+ trusted: false,
+ fileName: "untrusted-evil-1.0.0.bowerpack",
+ id: null,
+ version: null,
+ name: null,
+ description: null,
+ owner: null,
+ builtAtUtc: null,
+ packHash: null,
+ signedByKeyId: null,
+ eventTypes: [],
+ policies: [],
+ redactions: [],
+ detectionCount: 0,
+ parserCount: 0,
+ sampleResults: [],
+ refusalReason: "Pack signature is invalid or not from a trusted key."
+ }
+ ],
+ groups: [
+ {
+ environment: "production",
+ eligibleCollectors: 2,
+ collectorIds: ["col-prod-1", "col-prod-2"]
+ }
+ ]
+};
+
+describe("PacksPage", () => {
+ const fetchMock = vi.fn();
+
+ beforeEach(() => {
+ vi.stubGlobal("fetch", fetchMock);
+ localStorage.setItem("bower-theme", "light");
+ localStorage.setItem("bower-console-view", "detailed");
+ });
+
+ afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+ fetchMock.mockReset();
+ localStorage.clear();
+ });
+
+ it("shows trusted packs, surfaces untrusted refusal reasons, and submits a group install with population diff", async () => {
+ const createdRequest: PackInstallRequestRecord = {
+ id: "0123456789abcdef0123456789abcdef",
+ packId: "linux-ssh-gateway",
+ packVersion: "1.0.0",
+ packName: "Linux SSH Gateway",
+ packHash: "abcdef0123456789abcdef0123456789",
+ signedByKeyId: "key-prod-1",
+ targetEnvironment: "production",
+ targetCollectorId: null,
+ status: "pending-review",
+ diff: {
+ packId: "linux-ssh-gateway",
+ packVersion: "1.0.0",
+ packHash: "abcdef0123456789abcdef0123456789",
+ eventTypesAdded: ["auth.ssh.failed", "auth.ssh.succeeded"],
+ policyChanges: [],
+ affectedCollectors: [
+ {
+ collectorId: "col-prod-1",
+ machineName: "prod-1",
+ environment: "production",
+ currentPolicyHash: "old-hash",
+ currentDesiredPolicyHash: null,
+ targetPolicyHash: "abcdef0123456789abcdef0123456789",
+ alreadyAssigned: false
+ },
+ {
+ collectorId: "col-prod-2",
+ machineName: "prod-2",
+ environment: "production",
+ currentPolicyHash: "old-hash",
+ currentDesiredPolicyHash: null,
+ targetPolicyHash: "abcdef0123456789abcdef0123456789",
+ alreadyAssigned: false
+ }
+ ]
+ },
+ reason: "Roll out SSH pack to production",
+ requestedByObjectId: "op-1",
+ requestedByName: "Alex Operator",
+ requestedAt: "2026-11-22T00:00:00Z",
+ reviewerName: null,
+ reviewedAt: null,
+ reviewReason: null
+ };
+
+ const installRequests: PackInstallRequestRecord[] = [];
+ fetchMock.mockImplementation((input: string | URL, init?: RequestInit) => {
+ const url = String(input);
+ if (url.endsWith("/api/access/me")) {
+ return Promise.resolve(
+ new Response(
+ JSON.stringify({
+ objectId: "op-1",
+ displayName: "Alex Operator",
+ roles: ["Bower.Operator"],
+ developmentAuthentication: true
+ }),
+ { status: 200 }
+ )
+ );
+ }
+ if (url.endsWith("/api/packs")) {
+ return Promise.resolve(new Response(JSON.stringify(galleryFixture), { status: 200 }));
+ }
+ if (url.endsWith("/api/packs/install-requests") && init?.method === "POST") {
+ installRequests.push(createdRequest);
+ return Promise.resolve(new Response(JSON.stringify(createdRequest), { status: 201 }));
+ }
+ if (url.endsWith("/api/packs/install-requests")) {
+ return Promise.resolve(new Response(JSON.stringify(installRequests), { status: 200 }));
+ }
+ return Promise.resolve(new Response("Not found", { status: 404 }));
+ });
+
+ render(
+
+
+
+
+
+ );
+
+ await waitFor(() => {
+ expect(screen.getByText("Linux SSH Gateway")).toBeTruthy();
+ });
+
+ // Untrusted pack is clearly refused with server reason.
+ expect(screen.getByText("untrusted-evil-1.0.0.bowerpack")).toBeTruthy();
+ expect(
+ screen.getByText("Pack signature is invalid or not from a trusted key.")
+ ).toBeTruthy();
+
+ // Under-5-clicks install to collector group with population diff preview.
+ fireEvent.click(screen.getByRole("button", { name: "Install to group" }));
+ expect(screen.getByText(/Population diff preview/i)).toBeTruthy();
+ expect(screen.getByText(/2 collectors in/i)).toBeTruthy();
+
+ fireEvent.change(screen.getByLabelText("Reason for change"), {
+ target: { value: "Roll out SSH pack to production" }
+ });
+ fireEvent.click(screen.getByRole("button", { name: "Submit for approval" }));
+
+ await waitFor(() => {
+ expect(screen.getByText(/Pack install submitted for approval/i)).toBeTruthy();
+ });
+ });
+});
diff --git a/ui/Bower.Management.Web/src/pages/PacksPage.tsx b/ui/Bower.Management.Web/src/pages/PacksPage.tsx
new file mode 100644
index 00000000..93f53525
--- /dev/null
+++ b/ui/Bower.Management.Web/src/pages/PacksPage.tsx
@@ -0,0 +1,368 @@
+import { CheckCircle2, KeyRound, Package, ShieldAlert, ShieldCheck } from "lucide-react";
+import { useState } from "react";
+import { Link } from "react-router-dom";
+import { useApi } from "../api";
+import { EmptyState, Page, ResourceState } from "../components/ui";
+import { useResource } from "../hooks/useResource";
+import { formatDate } from "../lib/format";
+import type {
+ Access,
+ PackGalleryItem,
+ PackGalleryResponse,
+ PackInstallRequestRecord
+} from "../types";
+
+export function PacksPage() {
+ const api = useApi();
+ const [refresh, setRefresh] = useState(0);
+ const gallery = useResource("/api/packs", refresh);
+ const requests = useResource("/api/packs/install-requests", refresh);
+ const access = useResource("/api/access/me");
+ const [installingKey, setInstallingKey] = useState(null);
+ const [targetEnvironment, setTargetEnvironment] = useState("");
+ const [reason, setReason] = useState("");
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState(null);
+ const [submitted, setSubmitted] = useState(null);
+
+ const canOperate =
+ access.data?.roles.some(
+ (role) =>
+ role === "Bower.Operator" ||
+ role === "Bower.Approver" ||
+ role === "Bower.Administrator"
+ ) ?? false;
+
+ function startInstall(pack: PackGalleryItem, defaultGroup: string) {
+ setInstallingKey(`${pack.id}@${pack.version}`);
+ setTargetEnvironment(defaultGroup);
+ setReason("");
+ setError(null);
+ setSubmitted(null);
+ }
+
+ async function submitInstall(pack: PackGalleryItem) {
+ if (!pack.id || !pack.version) {
+ return;
+ }
+ if (!targetEnvironment.trim()) {
+ setError("Choose a collector group first.");
+ return;
+ }
+ if (!reason.trim()) {
+ setError("Enter a short reason before submitting for approval.");
+ return;
+ }
+ setBusy(true);
+ setError(null);
+ try {
+ const created = await api("/api/packs/install-requests", {
+ method: "POST",
+ body: JSON.stringify({
+ packId: pack.id,
+ version: pack.version,
+ targetEnvironment: targetEnvironment.trim(),
+ reason: reason.trim()
+ })
+ });
+ setSubmitted(created);
+ setInstallingKey(null);
+ setRefresh((value) => value + 1);
+ } catch (submitError) {
+ setError(submitError instanceof Error ? submitError.message : "Could not submit pack install request.");
+ } finally {
+ setBusy(false);
+ }
+ }
+
+ return (
+
+ {error && (
+
+ {error}
+
+ )}
+ {submitted && (
+
+ Pack install submitted for approval: {submitted.packName} v{submitted.packVersion} for{" "}
+ {submitted.targetEnvironment ?? submitted.targetCollectorId} (
+ {submitted.diff.affectedCollectors.length} collector
+ {submitted.diff.affectedCollectors.length === 1 ? "" : "s"}).{" "}
+
+ Open Approvals
+
+
+ )}
+
+
+ {(data) => {
+ const trusted = data.packs.filter((item) => item.trusted);
+ const refused = data.packs.filter((item) => !item.trusted);
+ const defaultGroup = data.groups[0]?.environment ?? "";
+
+ if (!data.configured) {
+ return (
+ }
+ title="Pack gallery directory is not configured"
+ detail="Set BOWER_PACK_GALLERY_DIR and BOWER_PACK_TRUSTED_KEYS on the management API to list and verify signed .bowerpack archives."
+ />
+ );
+ }
+
+ return (
+ <>
+
+
+
Verified packs
+
+ {trusted.length} trusted · {data.trustedKeyCount} signing key
+ {data.trustedKeyCount === 1 ? "" : "s"}
+
+
+
+ {trusted.length === 0 ? (
+ }
+ title="No trusted packs found"
+ detail="Add signed .bowerpack files signed by a key in BOWER_PACK_TRUSTED_KEYS to list them here."
+ />
+ ) : (
+
+ {trusted.map((pack) => {
+ const key = `${pack.id}@${pack.version}`;
+ const isInstalling = installingKey === key;
+ const selectedGroup = data.groups.find((group) => group.environment === targetEnvironment);
+ const passedSamples = pack.sampleResults.filter((sample) => sample.passed).length;
+
+ return (
+
+
+
+
+ Signed & verified
+
+ v{pack.version}
+ {pack.signedByKeyId && key {pack.signedByKeyId}}
+
+
{pack.name ?? pack.id}
+ {pack.description &&
{pack.description}
}
+
+
+
+
Pack ID
+ {pack.id}
+
+
+
Owner
+ {pack.owner ?? "—"}
+
+
+
Event types ({pack.eventTypes.length})
+ {pack.eventTypes.join(", ") || "None"}
+
+
+
What gets redacted
+ {pack.redactions.join(" ") || "Default Australian privacy policy."}
+
+
+
Sample checks
+
+ {pack.sampleResults.length === 0
+ ? "No samples"
+ : `${passedSamples} of ${pack.sampleResults.length} passed`}
+
+
+
+
+ {pack.sampleResults.length > 0 && (
+
+ Sample results (decisions only, post-redaction)
+
+ {pack.sampleResults.map((sample) => (
+
+ {sample.name} : {sample.passed ? "passed" : "failed"} (expected{" "}
+ {sample.expectedDecision}, got {sample.actualDecision})
+
+ ))}
+
+
+ )}
+
+
+
+ {!canOperate ? (
+
+
+
+ Viewing only. Bower.Operator or higher is required to request a pack
+ install.
+
+
+ ) : data.groups.length === 0 ? (
+
+
Approve at least one collector before installing packs to a group.
+
+ ) : !isInstalling ? (
+
startInstall(pack, defaultGroup)}
+ >
+ Install to group
+
+ ) : (
+
{
+ event.preventDefault();
+ void submitInstall(pack);
+ }}
+ >
+ Collector group
+ setTargetEnvironment(event.target.value)}
+ >
+ {data.groups.map((group) => (
+
+ {group.environment} ({group.eligibleCollectors} collector
+ {group.eligibleCollectors === 1 ? "" : "s"})
+
+ ))}
+
+
+
+
Population diff preview
+
+ Will assign pack hash {pack.packHash?.slice(0, 12)} to{" "}
+ {selectedGroup?.eligibleCollectors ?? 0} collector
+ {selectedGroup?.eligibleCollectors === 1 ? "" : "s"} in{" "}
+ {targetEnvironment} , enabling {pack.eventTypes.length} event type
+ {pack.eventTypes.length === 1 ? "" : "s"} ({pack.eventTypes.join(", ")}).
+
+
+
+ Reason for change
+ setReason(event.target.value)}
+ />
+
+
+ {busy ? "Submitting…" : "Submit for approval"}
+
+ setInstallingKey(null)}
+ >
+ Cancel
+
+
+
+ )}
+
+
+ );
+ })}
+
+ )}
+
+
+ {refused.length > 0 && (
+
+
+
Refused packs (untrusted)
+ Blocked by signature or integrity verification
+
+
+ {refused.map((pack) => (
+
+
+
+ Refused — untrusted
+
+
{pack.fileName}
+
{pack.refusalReason ?? "Pack failed signature verification."}
+
+
+ ))}
+
+
+ )}
+ >
+ );
+ }}
+
+
+
+
+
Pack install requests
+ Reviewed through Approvals
+
+
+ {(items) =>
+ items.length === 0 ? (
+ }
+ title="No pack install requests yet"
+ detail="Choose a verified pack above and click Install to group to create a four-eyes approval request."
+ />
+ ) : (
+
+
+
+
+ Pack
+ Target
+ Status
+ Requested by
+ Reviewed by
+
+
+
+ {items.map((item) => (
+
+
+ {item.packName} v{item.packVersion}
+
+ {item.targetEnvironment ?? item.targetCollectorId}
+
+
+ {item.status}
+
+
+
+ {item.requestedByName} ({formatDate(item.requestedAt)})
+
+ {item.reviewerName ?? "Awaiting approver"}
+
+ ))}
+
+
+
+ )
+ }
+
+
+
+ );
+}
diff --git a/ui/Bower.Management.Web/src/types.ts b/ui/Bower.Management.Web/src/types.ts
index ad952f50..e28e26a9 100644
--- a/ui/Bower.Management.Web/src/types.ts
+++ b/ui/Bower.Management.Web/src/types.ts
@@ -723,3 +723,97 @@ export interface PipelineTapResponse {
frames: PipelineTapFrame[];
capturedAt: string;
}
+
+export interface PackPolicySummary {
+ id: string;
+ version: string;
+ action: string;
+ eventTypes: string[];
+ hash: string;
+}
+
+export interface PackSampleSummary {
+ name: string;
+ passed: boolean;
+ expectedDecision: string;
+ actualDecision: string;
+ problems: string[];
+}
+
+export interface PackGalleryItem {
+ trusted: boolean;
+ fileName: string;
+ id: string | null;
+ version: string | null;
+ name: string | null;
+ description: string | null;
+ owner: string | null;
+ builtAtUtc: string | null;
+ packHash: string | null;
+ signedByKeyId: string | null;
+ eventTypes: string[];
+ policies: PackPolicySummary[];
+ redactions: string[];
+ detectionCount: number;
+ parserCount: number;
+ sampleResults: PackSampleSummary[];
+ refusalReason: string | null;
+}
+
+export interface PackTargetGroup {
+ environment: string;
+ eligibleCollectors: number;
+ collectorIds: string[];
+}
+
+export interface PackGalleryResponse {
+ configured: boolean;
+ trustedKeyCount: number;
+ packs: PackGalleryItem[];
+ groups: PackTargetGroup[];
+}
+
+export interface PackPolicyDiffEntry {
+ policyId: string;
+ change: string;
+ detail: string;
+}
+
+export interface PackCollectorDiffEntry {
+ collectorId: string;
+ machineName: string;
+ environment: string;
+ currentPolicyHash: string;
+ currentDesiredPolicyHash: string | null;
+ targetPolicyHash: string;
+ alreadyAssigned: boolean;
+}
+
+export interface PackPopulationDiff {
+ packId: string;
+ packVersion: string;
+ packHash: string;
+ eventTypesAdded: string[];
+ policyChanges: PackPolicyDiffEntry[];
+ affectedCollectors: PackCollectorDiffEntry[];
+}
+
+export interface PackInstallRequestRecord {
+ id: string;
+ packId: string;
+ packVersion: string;
+ packName: string;
+ packHash: string;
+ signedByKeyId: string;
+ targetEnvironment: string | null;
+ targetCollectorId: string | null;
+ status: "pending-review" | "approved" | "rejected";
+ diff: PackPopulationDiff;
+ reason: string;
+ requestedByObjectId: string;
+ requestedByName: string;
+ requestedAt: string;
+ reviewerName: string | null;
+ reviewedAt: string | null;
+ reviewReason: string | null;
+}