You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(delivery): apply JMESPath payload transformation before delivery (ADR-003 Phase 2)
DeliveryWorker now consults the new IPayloadTransformer abstraction (backed by JmesPath.Net 1.1.0) before signing and POSTing the payload. The transformed payload is what gets signed, so the receiver verifies the signature against the body they actually receive.
The delivery pipeline is fail-safe by construction. Transformation only runs when (a) the global TransformationOptions.Enabled flag is true, (b) the endpoint has TransformEnabled set, and (c) TransformExpression is non-empty. Any failure — invalid expression, 100 ms timeout, output exceeding 256 KB UTF-8, or unparseable JSON — returns PayloadTransformResult.FailOpen, the worker logs a warning, and delivery proceeds with the original payload. Two new metrics expose the split: webhookengine.transformations.applied counts successful applications, and webhookengine.transformations.failed_open counts fallbacks.
JmesPathPayloadTransformer wraps the library call in Task.Run + Task.Wait(timeout) so a runaway expression cannot stall the delivery thread; output size is checked via Encoding.UTF8.GetByteCount before returning success. The class is stateless and registered as a singleton.
The configuration surface lives under WebhookEngine:Transformation in appsettings (Enabled=true, TimeoutMs=100, MaxOutputBytes=262144). Six unit tests under WebhookEngine.Infrastructure.Tests.Services cover the reshape happy path, identity selector, invalid syntax, empty expression, oversized output, and invalid JSON cases. README test count bumped from 136 to 142.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,8 @@ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.ht
8
8
## [Unreleased]
9
9
10
10
### Added
11
-
-**Payload transformation schema and API (ADR-003 Phase 1):** endpoints now accept `transformExpression` (JMESPath, max 4096 chars), `transformEnabled` (kill switch, default `false`), and a server-managed `transformValidatedAt` timestamp on create/update. Both the public Bearer-key API (`POST /api/v1/endpoints`, `PUT /api/v1/endpoints/{id}`) and the dashboard endpoints (`POST /api/v1/dashboard/endpoints`, `PUT /api/v1/dashboard/endpoints/{id}`) carry the new fields, and `EndpointResponseDto` exposes them on read. Stored only — pipeline integration (delivery-time application with `JmesPath.Net` + 100 ms timeout + fail-open) and the dashboard editor land in ADR-003 Phase 2 and Phase 3 respectively.
11
+
-**Payload transformation delivery integration (ADR-003 Phase 2):** the `DeliveryWorker` now applies the per-endpoint JMESPath expression to the payload before signing and POSTing. Backed by the new `IPayloadTransformer` abstraction and `JmesPathPayloadTransformer` (JmesPath.Net 1.1.0). Hard guardrails enforced at delivery time: 100 ms wall-clock timeout, 256 KB output cap, and a global kill switch via `WebhookEngine:Transformation:Enabled` (defaults to `true`). Every transformation is fail-open — invalid expressions, timeouts, oversized output, or invalid JSON fall back to the original payload with a warning log. New OpenTelemetry counters `webhookengine.transformations.applied` and `webhookengine.transformations.failed_open` track success vs fallback. Six unit tests cover identity, reshape, invalid expression, empty expression, output-size, and invalid-json paths.
12
+
-**Payload transformation schema and API (ADR-003 Phase 1):** endpoints now accept `transformExpression` (JMESPath, max 4096 chars), `transformEnabled` (kill switch, default `false`), and a server-managed `transformValidatedAt` timestamp on create/update. Both the public Bearer-key API (`POST /api/v1/endpoints`, `PUT /api/v1/endpoints/{id}`) and the dashboard endpoints (`POST /api/v1/dashboard/endpoints`, `PUT /api/v1/dashboard/endpoints/{id}`) carry the new fields, and `EndpointResponseDto` exposes them on read. The dashboard expression editor and live preview land in ADR-003 Phase 3.
12
13
-**Security automations:** CodeQL workflow (csharp + javascript-typescript, push/PR/Mondays at 06:30 UTC), Dependency Review action on PRs (high-severity fail + GPL/LGPL/AGPL/EUPL/SSPL deny-list), and Dependabot config covering NuGet, npm, GitHub Actions, and Docker base images. Five repo labels (`dependencies`, `nuget`, `npm`, `ci`, `docker`) created to support the Dependabot config.
0 commit comments