Skip to content

Commit 64b3b4a

Browse files
chore(python): release 5.21.0
1 parent 92e5213 commit 64b3b4a

4 files changed

Lines changed: 35 additions & 0 deletions

File tree

generators/python/sdk/changes/unreleased/webhook-body-hash-binding.yml renamed to generators/python/sdk/changes/5.21.0/webhook-body-hash-binding.yml

File renamed without changes.

generators/python/sdk/changes/unreleased/webhook-signature-verification.yml renamed to generators/python/sdk/changes/5.21.0/webhook-signature-verification.yml

File renamed without changes.

generators/python/sdk/changes/unreleased/webhook-twilio-compatible-verification.yml renamed to generators/python/sdk/changes/5.21.0/webhook-twilio-compatible-verification.yml

File renamed without changes.

generators/python/sdk/versions.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
11
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
2+
- version: 5.21.0
3+
changelogEntry:
4+
- summary: |
5+
Add webhook body-hash binding support to `verify_signature`. When a webhook's HMAC
6+
signature declares a `bodyHashBinding` in the IR, the generated helper first recomputes
7+
the raw request body's hash (using the binding's own algorithm/encoding), extracts the
8+
configured query parameter from the notification URL, and timing-safe-compares them
9+
(failing closed on a missing or mismatched hash) before performing the existing HMAC
10+
verification over the verbatim notification URL. Adds stdlib-only `compute_hash` (unkeyed
11+
digest) and read-only `get_webhook_query_parameter` core utilities. Output is unchanged
12+
when no body-hash binding is present.
13+
type: feat
14+
- summary: |
15+
Add webhook signature verification support. When a webhook declares HMAC signature
16+
verification in the IR, the generated SDK now emits a `WebhooksHelper` with a static
17+
`verify_signature` method that validates the signature (and optional timestamp) using a
18+
new stdlib-only core utility (`hmac`/`hashlib`/`base64` with constant-time comparison).
19+
type: feat
20+
- summary: |
21+
Extend `verify_signature` with Twilio-compatible webhook verification. The generated
22+
helper now (1) accepts either a raw string or a multi-value form map for `request_body`
23+
when the IR sets `payloadFormat.bodySort`, sorting and deduping keys and per-key values
24+
before signing; (2) branches at runtime on a `bodyHashBinding`: a JSON request (body-hash
25+
query parameter present) recomputes and timing-safe-compares the raw-body hash and signs
26+
the notification URL only, while a classic form request signs the URL plus the sorted
27+
params with no body-hash check; (3) verifies against several normalized notification-URL
28+
forms when `notificationUrlNormalization` is set, succeeding on the first constant-time
29+
match; and (4) is a pure boolean that fails closed with `False` on invalid inputs
30+
(missing parameters, malformed timestamps, unparseable URLs) rather than raising. Adds a
31+
stdlib-only `notification_url_candidates` core utility (port and legacy-query-encoding
32+
variants via `urllib.parse`). Output is unchanged for webhooks that do not configure these
33+
fields, aside from the no-throw behavior on the verification path.
34+
type: feat
35+
createdAt: "2026-07-22"
36+
irVersion: 67
237
- version: 5.20.2
338
changelogEntry:
439
- summary: |

0 commit comments

Comments
 (0)