feat(eda): sources own signing, with UUIDv7 paths and approved unsigned option

A source is the capture endpoint: a UUIDv7 path by default or a unique
URL-safe custom path, signed by default with an Archie-generated secret
(encrypted via the bindings cipher), or unsigned after an approval.
Intake verifies X-Hub-Signature-256/X-Signature-256 against the source
secret before redaction; an unauthenticated event on a signed source is
captured but never dispatched, an event on an approved unsigned source
dispatches and is marked unsigned. The binding secret is retired; migration
0006 derives sources from existing binding and capture source strings,
moving each binding's secret onto its source. SourceStore crosses the
State Store gRPC contract. The dashboard gains a sources panel and flags
unsigned in the capture inspector, binding list and task timeline.
This commit is contained in:
sam committed 2026-09-24 14:26:21 +10:00
1 parent 5009288729
commit 6adbdc55a9
59 files changed
+3741 -1660

No files matched your search

+3 -46
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { Check, Copy, RefreshCw } from "@lucide/vue";
import { computed, ref, watch } from "vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
@@ -7,14 +6,11 @@ import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Field, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group";
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Spinner } from "@/components/ui/spinner";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import {
draftFromBinding,
emptyDraft,
generateSecret,
type Binding,
type BindingDraft,
type MappingOption,
@@ -23,8 +19,7 @@ import {
/**
* The binding editor: name, the matcher source senders POST to, the field
* mapping, the workflow, an optional repo pin, and the shared secret their
* signature is checked against.
* mapping, the workflow and an optional repo pin. Signing is the source's.
*/
const props = defineProps<{
@@ -51,17 +46,11 @@ watch(
);
const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
const copied = ref(false);
async function copySecret(): Promise<void> {
await navigator.clipboard.writeText(draft.value.secret);
copied.value = true;
setTimeout(() => (copied.value = false), 1500);
}
</script>
<template>
<Dialog v-model:open="open">
<!-- Seven fields make this taller than a short window; the dialog itself
<!-- Six fields make this taller than a short window; the dialog itself
scrolls rather than clipping its own Save button. -->
<DialogContent class="max-h-[85vh] overflow-y-auto sm:max-w-lg">
<DialogHeader>
@@ -81,7 +70,7 @@ async function copySecret(): Promise<void> {
<Field>
<FieldLabel for="binding-source">Source</FieldLabel>
<Input id="binding-source" v-model="draft.source" />
<FieldDescription>The path segment senders POST to, for example "sentry".</FieldDescription>
<FieldDescription>The path of a source, from the sources list above.</FieldDescription>
</Field>
<Field>
@@ -132,38 +121,6 @@ async function copySecret(): Promise<void> {
</FieldDescription>
</Field>
<Field>
<FieldLabel for="binding-secret">Signing secret</FieldLabel>
<InputGroup v-if="draft.secret">
<InputGroupInput id="binding-secret" :model-value="draft.secret" class="font-mono text-xs" readonly />
<InputGroupAddon align="inline-end">
<Tooltip>
<TooltipTrigger as-child>
<InputGroupButton size="icon-xs" aria-label="Copy secret" @click="copySecret">
<Check v-if="copied" />
<Copy v-else />
</InputGroupButton>
</TooltipTrigger>
<TooltipContent>Copy secret</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger as-child>
<InputGroupButton size="icon-xs" aria-label="Regenerate secret" @click="draft.secret = generateSecret()">
<RefreshCw />
</InputGroupButton>
</TooltipTrigger>
<TooltipContent>Regenerate</TooltipContent>
</Tooltip>
</InputGroupAddon>
</InputGroup>
<div v-else class="flex h-9 items-center justify-between rounded-md border px-3 text-sm">
<span class="text-fg-muted">Stored · HMAC-SHA256</span>
<Button type="button" variant="ghost" size="sm" @click="draft.secret = generateSecret()">
<RefreshCw data-icon="inline-start" />
Replace
</Button>
</div>
</Field>
</FieldGroup>
<!-- Beside the buttons, not at the top: the dialog scrolls, and Save is
+7 -1
View File
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { Check, Pencil, Trash2 } from "@lucide/vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { TableCell, TableRow } from "@/components/ui/table";
import BindingStatusBadge from "./BindingStatusBadge.vue";
@@ -18,7 +19,12 @@ const emit = defineEmits<{
<template>
<TableRow>
<TableCell class="font-medium">{{ props.binding.name }}</TableCell>
<TableCell class="font-mono text-fg-muted">{{ matcherSource(props.binding) }}</TableCell>
<TableCell class="font-mono text-fg-muted">
<div class="flex items-center gap-2">
{{ matcherSource(props.binding) }}
<Badge v-if="props.binding.unsigned" variant="warn">Unsigned</Badge>
</div>
</TableCell>
<TableCell>{{ props.binding.workflow || "—" }}</TableCell>
<TableCell class="font-mono text-fg-muted">{{ repoPin(props.binding) }}</TableCell>
<TableCell><BindingStatusBadge :status="props.binding.status" /></TableCell>
+3
View File
@@ -4,6 +4,7 @@ import { onMounted, ref } from "vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import SourcesPanel from "@/sources/SourcesPanel.vue";
import { useLiveResource } from "@/stores/live-updates";
import BindingEditor from "./BindingEditor.vue";
import BindingsTable from "./BindingsTable.vue";
@@ -69,6 +70,8 @@ async function handleDelete(binding: Binding): Promise<void> {
<template>
<div>
<SourcesPanel />
<!-- The tab owns the actions that belong to it. The page's header names the
page, not this panel, so nothing here repeats "Events". -->
<div class="mb-4 flex flex-wrap items-center justify-end gap-2">
+3 -15
View File
@@ -6,9 +6,8 @@
*/
/**
* A binding as GET /api/bindings returns it. Secret is never returned: the
* daemon strips it from every read, and a blank secret on update is its
* server-side "keep the current one".
* A binding as GET /api/bindings returns it. Signing belongs to the source the
* matcher names; unsigned is set when that source takes unsigned events.
*/
export interface Binding {
id: string;
@@ -21,6 +20,7 @@ export interface Binding {
repo?: string;
status?: string;
version?: number;
unsigned?: boolean;
}
/** The fields of GET /api/mappings this page needs. */
@@ -71,7 +71,6 @@ export interface BindingDraft {
workflow: string;
owner: string;
repo: string;
secret: string;
}
export function emptyDraft(): BindingDraft {
@@ -83,7 +82,6 @@ export function emptyDraft(): BindingDraft {
workflow: "",
owner: "",
repo: "",
secret: generateSecret(),
};
}
@@ -96,9 +94,6 @@ export function draftFromBinding(binding: Binding): BindingDraft {
workflow: binding.workflow || "",
owner: binding.owner || "",
repo: binding.repo || "",
// Deliberately blank: the secret is never sent to the browser, and an
// empty one on update keeps whatever the sender already signs with.
secret: "",
};
}
@@ -111,16 +106,9 @@ export function bindingPayload(draft: BindingDraft): Record<string, unknown> {
workflow: draft.workflow,
owner: draft.owner,
repo: draft.repo,
secret: draft.secret,
};
}
/** A 32-byte hex signing secret for a new binding. */
export function generateSecret(): string {
const bytes = crypto.getRandomValues(new Uint8Array(32));
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
}
/** The repo pin a row shows, or an em dash when the binding takes the
* single-configured-repo default. */
export function repoPin(binding: Binding): string {