Skip to content

Commit 037ab5f

Browse files
authored
Create README.md
1 parent 27f1db0 commit 037ab5f

File tree

1 file changed

+26
-0
lines changed
  • Integration/Scripted REST Api/Webhook receiver with HMAC SHA-256 validation

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Webhook receiver with HMAC SHA-256 validation
2+
3+
## What this solves
4+
Inbound webhooks should be verified to ensure the payload really came from the sender. This receiver validates an `X-Signature` header containing an HMAC SHA-256 of the request body using a shared secret. Invalid signatures return HTTP 401.
5+
6+
## Where to use
7+
- Scripted REST API resource script
8+
- Include the `HmacUtils` Script Include in the same app or global
9+
10+
## How it works
11+
- Reads raw request body and the `X-Signature` header
12+
- Computes HMAC SHA-256 using the shared secret
13+
- Compares in constant time to avoid timing attacks
14+
- If valid, inserts the payload into a target table or queues it for processing
15+
16+
## Configure
17+
- Set `SHARED_SECRET` (prefer credentials or encrypted properties)
18+
- Update `TARGET_TABLE` for successful inserts
19+
20+
## References
21+
- Scripted REST APIs
22+
https://www.servicenow.com/docs/bundle/zurich-application-development/page/build/applications/task/create-scripted-rest-api.html
23+
- REST API request/response objects
24+
https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/GlideHTTPRequest/concept/c_scripted-rest-api-request.html
25+
- Java crypto (used server-side)
26+
https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/Script/server_apis/concept/java-use.html

0 commit comments

Comments
 (0)