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
For information about endpoint validation with Cloud Events, see [Endpoint validation with CloudEvents 1.0](webhook-event-delivery.md##endpoint-validation-with-cloudevents-v10).
Copy file name to clipboardExpand all lines: articles/event-grid/webhook-event-delivery.md
+64-1Lines changed: 64 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,70 @@ Like many other services that support webhooks, Event Grid requires you to prove
13
13
14
14
15
15
## Endpoint validation with CloudEvents v1.0
16
-
CloudEvents v1.0 implements its own abuse protection semantics using the **HTTP OPTIONS** method. You can read more about it [here](https://github.com/cloudevents/spec/blob/v1.0/http-webhook.md#4-abuse-protection). When you use the CloudEvents schema for output, Event Grid uses the CloudEvents v1.0 abuse protection in place of the Event Grid validation event mechanism.
16
+
CloudEvents v1.0 implements its own abuse protection semantics using the **HTTP OPTIONS** method. When you use the CloudEvents schema for output, Event Grid uses the CloudEvents v1.0 abuse protection in place of the Event Grid validation event mechanism.
17
+
18
+
### CloudEvent v1.0 abuse protection
19
+
Any system that allows registration of and delivery of notifications to arbitrary HTTP endpoints can potentially be abused such that someone maliciously or inadvertently registers the address of a system that doesn't expect such requests and for which the registering party isn't authorized to perform such a registration. In extreme cases, a notification infrastructure could be abused to launch denial-of-service attacks against an arbitrary web-site.
20
+
21
+
To protect the sender from being abused in such a way, a legitimate delivery target needs to indicate that it agrees with notifications being delivered to it.
22
+
23
+
Reaching the delivery agreement is realized using the following validation handshake. The handshake can either be executed immediately at registration time
24
+
or as a "preflight" request immediately preceding a delivery.
25
+
26
+
It's important to understand that the handshake doesn't aim to establish an authentication or authorization context. It only serves to protect the sender
27
+
from being told to a push to a destination that isn't expecting the traffic. While this specification mandates use of an authorization model, this mandate isn't sufficient to protect any arbitrary website from unwanted traffic if that website doesn't implement access control and therefore ignores the `Authorization` header.
28
+
29
+
Delivery targets SHOULD support the abuse protection feature. If a target doesn't support the feature, the sender MAY choose not to send to the target, at all, or send only at a very low request rate.
30
+
31
+
### 4.1. Validation request
32
+
33
+
The validation request uses the **HTTP OPTIONS** method. The request is directed to the exact resource target URI that is being registered. With the validation request, the sender asks the target for permission to send notifications, and it can declare a desired request rate (requests per minute). The delivery target will respond with a permission statement and the permitted request rate. Here's a couple of the header fields are for inclusion in the validation request.
34
+
35
+
#### 4.1.2. WebHook-Request-Origin
36
+
37
+
The `WebHook-Request-Origin` header MUST be included in the validation request and requests permission to send notifications from this sender, and contains a
38
+
Domain Name System (DNS) expression that identifies the sending system, for example `eventemitter.example.com`. The value is meant to summarily identify all sender
39
+
instances that act on the behalf of a certain system, and not an individual host.
40
+
41
+
After the handshake and if permission has been granted, the sender MUST use the `Origin` request header for each delivery request, with the value matching that
42
+
of this header.
43
+
44
+
Example:
45
+
46
+
```bash
47
+
WebHook-Request-Origin: eventemitter.example.com
48
+
```
49
+
50
+
### 4.2. Validation response
51
+
52
+
If and only if the delivery target does allow delivery of the events, it MUST reply to the request by including the `WebHook-Allowed-Origin` and
53
+
`WebHook-Allowed-Rate` headers. If the delivery target chooses to grant permission by callback, it withholds the response headers.
54
+
55
+
If the delivery target doesn't allow delivery of the events or doesn't expect delivery of events and nevertheless handles the HTTP OPTIONS method, the
56
+
existing response ought not to be interpreted as consent, and therefore the handshake can't rely on status codes. If the delivery target otherwise doesn't
57
+
handle the HTTP OPTIONS method, it SHOULD respond with HTTP status code 405, as if OPTIONS weren't supported.
58
+
59
+
The OPTIONS response SHOULD include the `Allow` header indicating the POST method being permitted. Other methods MAY be permitted on the
60
+
resource, but their function is outside the scope of this specification.
61
+
62
+
#### 4.2.1. WebHook-Allowed-Origin
63
+
64
+
The `WebHook-Allowed-Origin` header MUST be returned when the delivery target agrees to notification delivery by the origin service. Its value MUST either be
65
+
the origin name supplied in the `WebHook-Request-Origin` header, or a singular asterisk character ('\*'), indicating that the delivery target supports
66
+
notifications from all origins.
67
+
68
+
```bash
69
+
WebHook-Allowed-Origin: eventemitter.example.com
70
+
```
71
+
72
+
Or
73
+
74
+
```bash
75
+
WebHook-Request-Origin: *
76
+
```
77
+
78
+
> [!IMPORTANT]
79
+
> For more information about the abuse protection, see [Abuse protection in the HTTP 1.1 Web Hooks for event delivery spec](https://github.com/cloudevents/spec/blob/v1.0/http-webhook.md#4-abuse-protection).
17
80
18
81
## Endpoint validation with Event Grid events
19
82
When you use any of the following three Azure services, the Azure infrastructure automatically handles this validation:
0 commit comments