fix(control-plane): require signed approval webhooks#504
fix(control-plane): require signed approval webhooks#504AbirAbbas merged 4 commits intoAgent-Field:mainfrom
Conversation
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
|
thanks for the pr, will review after tests pass (currently failing)🙏 |
SummaryFixed failing functional tests by updating the test harness to comply with the new Changes
|
|
Can i try working on phase 2? |
yup go for it! |
Summary
Phase 1 migrates the approval webhook (
POST /api/v1/webhooks/approval-response) to HMAC-only authentication, removing reliance on global API key auth.agentfield.approval.webhook_secret(orAGENTFIELD_APPROVAL_WEBHOOK_SECRET) and reject requests if missing or invalid.The endpoint remains registered but:
webhook_secretis not configured (feature effectively disabled).File-level Changes
control-plane/internal/server/routes_middleware.go: Skip API key auth for webhook path viaSkipPaths(added helperuniqueStrings).control-plane/internal/server/routes_middleware_additional_test.go: Add test ensuring webhook bypasses API key auth while other routes still enforce it.control-plane/internal/handlers/webhook_approval.go: Enforce HMAC-only auth (503 if secret missing, 401 for invalid or missing signatures). UpdateverifySignatureto return false when secret is empty.control-plane/internal/handlers/webhook_approval_test.go: Update tests to include signed requests and add coverage for missing secret, missing signature, invalid signature, andt=...,v1=...signature format.control-plane/internal/config/config.go: UpdateApprovalConfig.WebhookSecretcomment (now required; empty disables endpoint).control-plane/config/agentfield.yaml: Updateapproval.webhook_secretdocumentation.control-plane/internal/server/apicatalog/catalog.go: Add webhook auth level.control-plane/internal/server/apicatalog/catalog_entries.go: Mark endpoint asAuthLevel: "webhook"and clarify description.control-plane/internal/server/apicatalog/catalog_test.go: Extend tests for webhook auth accessibility.Testing
./scripts/test-all.shAdditional verification:
Ran targeted Go tests:
Verified:
Checklist
Screenshots
N/A (no UI changes)
Related Issues
#237