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:
1 parent
5009288729
commit
6adbdc55a9
59 files changed
+3741
-1660
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user