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
{{ message }}
Repository navigation
Commit ce07e1f
Browse filesBrowse the repository at this point in the historyBrowse files
fix(spec): config.signature refuses x-objectstack-signature and the reserved headers as its header
Contract review round 1. A declared header naming x-objectstack-signature, in
any case, re-admitted the body-only sha256= form that ruling B on #22805
refuses inbound; it is now refused at parse, as is a closed list of
credential, routing, framing and idempotency headers
(API_TRIGGER_SIGNATURE_RESERVED_HEADERS). The contract states that a repeated
header is verified as its one comma-joined value, and that an unusable
declaration answers the same 401 INVALID_SIGNATURE.
Claude-Session: https://claude.ai/code/session_01WGufzggC8errMtPRYBUmoY
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .changeset/29983-api-trigger-signature.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ An inbound `api` hook admitted a post only by ObjectStack's own `x-objectstack-s
14
14
-`signs: 'body'`: the raw body alone, the whole header value (after an optional `prefix`) is the digest. DocuSign Connect: `{ signs: 'body', header: 'X-DocuSign-Signature-1', algorithm: 'hmac-sha256', encoding: 'base64' }`.
15
15
-`signs: 'timestamp.body'`: `T.RAW_BODY`, the header being `NAME=value` elements whose `timestampElement` carries `T` and whose `digestElement` carries the digest. Stripe-style: `{ signs: 'timestamp.body', header: 'Stripe-Signature', algorithm: 'hmac-sha256', encoding: 'hex', timestampElement: 't', digestElement: 'v1' }`.
16
16
17
-
The key is the start node's `config.secretRef`, as for an ObjectStack-signed hook. Declared, the scheme REPLACES the `x-objectstack-signature` check for that hook (one verifier per hook, never optional). The flow parse refuses a `signature` with no `secretRef`, one beside a literal `secret`, an algorithm other than `hmac-sha256`, an encoding other than `hex` or `base64`, a `timestamp.body` scheme with no `timestampElement` (or no `digestElement`, or the same name for both), a body-only scheme that names a timestamp element, and one on a flow that binds no `api` trigger.
17
+
The key is the start node's `config.secretRef`, as for an ObjectStack-signed hook. Declared, the scheme REPLACES the `x-objectstack-signature` check for that hook (one verifier per hook, never optional). The flow parse refuses a `signature` with no `secretRef`, one beside a literal `secret`, an algorithm other than `hmac-sha256`, an encoding other than `hex` or `base64`, a `timestamp.body` scheme with no `timestampElement` (or no `digestElement`, or the same name for both), a body-only scheme that names a timestamp element, a `header` naming `x-objectstack-signature` or another reserved header (`authorization`, `proxy-authorization`, `cookie`, `host`, `content-length`, `transfer-encoding`, `x-idempotency-key`) in any case, and one on a flow that binds no `api` trigger.
18
18
19
-
New exports from `@objectstack/spec/automation`: `ApiTriggerSignatureSchema`, `ApiTriggerSignature`, its two arms `ApiTriggerBodySignatureSchema` / `ApiTriggerBodySignature` and `ApiTriggerTimestampedSignatureSchema` / `ApiTriggerTimestampedSignature`, `API_TRIGGER_SIGNATURE_KEY`, `apiTriggerVerifierOf` (the one reader of which verifier a hook has: `objectstack-signature`, `declared` or `unusable`), `ApiTriggerVerifier`, `apiTriggerSignatureRefusals` and `ApiTriggerSignatureRefusal`. The `ITriggerApiService.handleInboundHook` contract text states what the implementer owes: a constant-time compare of the decoded 32 bytes, the same 300-second window as `x-objectstack-signature` for a scheme that signs a timestamp, no replay window for a body-only scheme, and the one `401 INVALID_SIGNATURE` for every failure.
19
+
New exports from `@objectstack/spec/automation`: `ApiTriggerSignatureSchema`, `ApiTriggerSignature`, its two arms `ApiTriggerBodySignatureSchema` / `ApiTriggerBodySignature` and `ApiTriggerTimestampedSignatureSchema` / `ApiTriggerTimestampedSignature`, `API_TRIGGER_SIGNATURE_KEY`, `API_TRIGGER_SIGNATURE_RESERVED_HEADERS`, `apiTriggerVerifierOf` (the one reader of which verifier a hook has: `objectstack-signature`, `declared` or `unusable`), `ApiTriggerVerifier`, `apiTriggerSignatureRefusals` and `ApiTriggerSignatureRefusal`. The `ITriggerApiService.handleInboundHook` contract text states what the implementer owes: a constant-time compare of the decoded 32 bytes, the same 300-second window as `x-objectstack-signature` for a scheme that signs a timestamp, no replay window for a body-only scheme, a repeated header read as its one comma-joined value, and the one `401 INVALID_SIGNATURE` for every failure, an unusable declaration included.
20
20
21
21
This release declares the key; the `api` trigger does not verify it yet. Until it does, a hook that declares `signature` is still verified by `x-objectstack-signature` alone, so every post its vendor sends is refused `401`, and none is admitted unverified.
Copy file name to clipboardExpand all lines: content/docs/references/automation/api-trigger-signature.mdx
+10-4Lines changed: 10 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,12 @@ Refusals, each anchored on the start node's `config.signature`:
49
49
scheme that names one, an undeclared key;
50
50
- a `timestamp.body` scheme whose timestamp and digest are the same
51
51
element of the header;
52
+
- a `header` that names `x-objectstack-signature`, in any case: the
53
+
platform's own header, whose body-only `sha256=` form ruling B on #22805
54
+
refuses inbound, so no declaration may re-admit it there without a
55
+
replay bound; or another reserved header
56
+
(`API_TRIGGER_SIGNATURE_RESERVED_HEADERS`: the request's
57
+
credentials, routing or framing, or the hook's idempotency key);
52
58
- a verifier with no key reference (`config.secretRef` absent);
53
59
- a verifier beside a literal `config.secret`: an inline key, and a second
54
60
source for the one key the hook has;
@@ -84,7 +90,7 @@ A sender that signs the raw body alone (DocuSign Connect, a GitHub-style `sha256
84
90
| Property | Type | Required | Description |
85
91
| :--- | :--- | :--- | :--- |
86
92
|**signs**|`'body'`| ✅ | The sender signs the raw body alone. No replay window applies. |
87
-
|**header**|`string`| ✅ | The HTTP header the sender puts its signature in (`X-DocuSign-Signature-1`, `Stripe-Signature`), matched without regard to case. The hook reads this header and never `x-objectstack-signature`. |
93
+
|**header**|`string`| ✅ | The HTTP header the sender puts its signature in (`X-DocuSign-Signature-1`, `Stripe-Signature`), matched without regard to case. The hook reads this header and never `x-objectstack-signature`. A reserved name is refused, in any case: `x-objectstack-signature`, `authorization`, `proxy-authorization`, `cookie`, `host`, `content-length`, `transfer-encoding` and `x-idempotency-key`. |
88
94
|**algorithm**|`Enum<'hmac-sha256'>`| ✅ | The MAC the sender computes under the key `config.secretRef` names. `hmac-sha256` is the only one. |
89
95
|**encoding**|`Enum<'hex' \| 'base64'>`| ✅ | How the sender writes the digest in the header: `hex` or `base64` (the RFC 4648 standard alphabet). The digest is decoded and compared as the 32 bytes of the HMAC. |
90
96
|**prefix**|`string`| optional | Literal text the sender writes before the digest in the header value (`sha256=` for a GitHub-style sender), checked and removed before decoding. Absent: the whole value is the digest. |
@@ -109,7 +115,7 @@ A sender that signs the raw body alone (DocuSign Connect, a GitHub-style `sha256
109
115
| Property | Type | Required | Description |
110
116
| :--- | :--- | :--- | :--- |
111
117
|**signs**|`'body'`| ✅ | The sender signs the raw body alone. No replay window applies. |
112
-
|**header**|`string`| ✅ | The HTTP header the sender puts its signature in (`X-DocuSign-Signature-1`, `Stripe-Signature`), matched without regard to case. The hook reads this header and never `x-objectstack-signature`. |
118
+
|**header**|`string`| ✅ | The HTTP header the sender puts its signature in (`X-DocuSign-Signature-1`, `Stripe-Signature`), matched without regard to case. The hook reads this header and never `x-objectstack-signature`. A reserved name is refused, in any case: `x-objectstack-signature`, `authorization`, `proxy-authorization`, `cookie`, `host`, `content-length`, `transfer-encoding` and `x-idempotency-key`. |
113
119
|**algorithm**|`Enum<'hmac-sha256'>`| ✅ | The MAC the sender computes under the key `config.secretRef` names. `hmac-sha256` is the only one. |
114
120
|**encoding**|`Enum<'hex' \| 'base64'>`| ✅ | How the sender writes the digest in the header: `hex` or `base64` (the RFC 4648 standard alphabet). The digest is decoded and compared as the 32 bytes of the HMAC. |
115
121
|**prefix**|`string`| optional | Literal text the sender writes before the digest in the header value (`sha256=` for a GitHub-style sender), checked and removed before decoding. Absent: the whole value is the digest. |
@@ -125,7 +131,7 @@ A sender that signs `<t>.<raw body>` and writes `t` beside the digest as `NAME=v
125
131
| Property | Type | Required | Description |
126
132
| :--- | :--- | :--- | :--- |
127
133
|**signs**|`'timestamp.body'`| ✅ | The sender signs `<t>.<raw body>`, `t` read from `timestampElement`. The replay window applies. |
128
-
|**header**|`string`| ✅ | The HTTP header the sender puts its signature in (`X-DocuSign-Signature-1`, `Stripe-Signature`), matched without regard to case. The hook reads this header and never `x-objectstack-signature`. |
134
+
|**header**|`string`| ✅ | The HTTP header the sender puts its signature in (`X-DocuSign-Signature-1`, `Stripe-Signature`), matched without regard to case. The hook reads this header and never `x-objectstack-signature`. A reserved name is refused, in any case: `x-objectstack-signature`, `authorization`, `proxy-authorization`, `cookie`, `host`, `content-length`, `transfer-encoding` and `x-idempotency-key`. |
129
135
|**algorithm**|`Enum<'hmac-sha256'>`| ✅ | The MAC the sender computes under the key `config.secretRef` names. `hmac-sha256` is the only one. |
130
136
|**encoding**|`Enum<'hex' \| 'base64'>`| ✅ | How the sender writes the digest in the header: `hex` or `base64` (the RFC 4648 standard alphabet). The digest is decoded and compared as the 32 bytes of the HMAC. |
131
137
|**timestampElement**|`string`| ✅ | Where the timestamp comes from: the NAME of the header element `NAME=<unix seconds>` (`t`). Its value, exactly as received, is the `<t>` of the signed `<t>.<raw body>`. |
@@ -145,7 +151,7 @@ A sender that signs `<t>.<raw body>` and writes `t` beside the digest as `NAME=v
145
151
| Property | Type | Required | Description |
146
152
| :--- | :--- | :--- | :--- |
147
153
|**signs**|`'timestamp.body'`| ✅ | The sender signs `<t>.<raw body>`, `t` read from `timestampElement`. The replay window applies. |
148
-
|**header**|`string`| ✅ | The HTTP header the sender puts its signature in (`X-DocuSign-Signature-1`, `Stripe-Signature`), matched without regard to case. The hook reads this header and never `x-objectstack-signature`. |
154
+
|**header**|`string`| ✅ | The HTTP header the sender puts its signature in (`X-DocuSign-Signature-1`, `Stripe-Signature`), matched without regard to case. The hook reads this header and never `x-objectstack-signature`. A reserved name is refused, in any case: `x-objectstack-signature`, `authorization`, `proxy-authorization`, `cookie`, `host`, `content-length`, `transfer-encoding` and `x-idempotency-key`. |
149
155
|**algorithm**|`Enum<'hmac-sha256'>`| ✅ | The MAC the sender computes under the key `config.secretRef` names. `hmac-sha256` is the only one. |
150
156
|**encoding**|`Enum<'hex' \| 'base64'>`| ✅ | How the sender writes the digest in the header: `hex` or `base64` (the RFC 4648 standard alphabet). The digest is decoded and compared as the 32 bytes of the HMAC. |
151
157
|**timestampElement**|`string`| ✅ | Where the timestamp comes from: the NAME of the header element `NAME=<unix seconds>` (`t`). Its value, exactly as received, is the `<t>` of the signed `<t>.<raw body>`. |
0 commit comments