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

+21 -21
View File
@@ -21,9 +21,15 @@ type bindingRequest struct {
// for multi-repo deployments. Both empty is valid (falls back to the
// daemon's single-configured-repo behaviour); binding.Validate
// rejects setting only one.
Owner string `json:"owner"`
Repo string `json:"repo"`
Secret string `json:"secret"`
Owner string `json:"owner"`
Repo string `json:"repo"`
}
// bindingView is a listed binding with its source's signing state, so the
// list can flag a binding that dispatches unsigned events.
type bindingView struct {
binding.Binding
Unsigned bool `json:"unsigned"`
}
func (s *Server) handleBindingsList(w http.ResponseWriter, r *http.Request) {
@@ -37,8 +43,17 @@ func (s *Server) handleBindingsList(w http.ResponseWriter, r *http.Request) {
http.Error(w, "list bindings failed", http.StatusInternalServerError)
return
}
stripBindingSecrets(bindings)
writeJSON(w, map[string]any{"bindings": bindings})
unsigned, err := s.unsignedSources(r.Context())
if err != nil {
s.Log.Error("list sources", "err", err)
http.Error(w, "list bindings failed", http.StatusInternalServerError)
return
}
views := make([]bindingView, 0, len(bindings))
for _, b := range bindings {
views = append(views, bindingView{Binding: b, Unsigned: unsigned[b.Matcher.Source]})
}
writeJSON(w, map[string]any{"bindings": views})
}
func (s *Server) handleBindingCreate(w http.ResponseWriter, r *http.Request) {
@@ -70,7 +85,6 @@ func (s *Server) handleBindingCreate(w http.ResponseWriter, r *http.Request) {
Workflow: req.Workflow,
Owner: req.Owner,
Repo: req.Repo,
Secret: req.Secret,
Status: binding.StatusPendingApproval,
}
if err := b.Validate(); err != nil {
@@ -93,7 +107,6 @@ func (s *Server) handleBindingCreate(w http.ResponseWriter, r *http.Request) {
http.Error(w, "create binding failed", http.StatusInternalServerError)
return
}
created.Secret = ""
w.WriteHeader(http.StatusCreated)
writeJSON(w, created)
}
@@ -118,7 +131,6 @@ func (s *Server) handleBindingGet(w http.ResponseWriter, r *http.Request) {
http.Error(w, "binding not found", http.StatusNotFound)
return
}
b.Secret = ""
writeJSON(w, b)
}
@@ -157,9 +169,8 @@ func (s *Server) handleBindingUpdate(w http.ResponseWriter, r *http.Request) {
Workflow: req.Workflow,
Owner: req.Owner,
Repo: req.Repo,
Secret: req.Secret,
}
if err := b.ValidateForUpdate(); err != nil {
if err := b.Validate(); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
@@ -181,7 +192,6 @@ func (s *Server) handleBindingUpdate(w http.ResponseWriter, r *http.Request) {
http.Error(w, "update binding failed", http.StatusInternalServerError)
return
}
updated.Secret = ""
writeJSON(w, updated)
}
@@ -243,15 +253,5 @@ func (s *Server) handleBindingApprove(w http.ResponseWriter, r *http.Request) {
http.Error(w, "approve binding failed", http.StatusInternalServerError)
return
}
updated.Secret = ""
writeJSON(w, updated)
}
// stripBindingSecrets zeroes the Secret field on every binding in the slice
// so the list handler never leaks a shared HMAC secret through /api/bindings.
// Single-binding reads do the same inline; this covers the list path.
func stripBindingSecrets(bs []binding.Binding) {
for i := range bs {
bs[i].Secret = ""
}
}