Skip to content

Commit e940477

Browse files
committed
chore(spec): regenerate the surfaces, references and strictness ledger for config.signature; export its two arms
The discriminated union's two arms are exported as their own defs (with type aliases and isomorphism pins) so the authorable-surface ledger records their keys. The trigger-api contract text states what the implementer owes for a declared scheme. Claude-Session: https://claude.ai/code/session_01WGufzggC8errMtPRYBUmoY Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8610b5c commit e940477

18 files changed

Lines changed: 324 additions & 21 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@objectstack/spec': minor
3+
---
4+
5+
feat(spec): an `api` flow's start node declares a third-party sender's signature scheme (`config.signature`), keyed by `config.secretRef` (#29983)
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: added
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) A new optional key on an api start node's open config: nothing an author wrote before is refused, renamed or re-shaped, so there is nothing at rest for a migration to rewrite. -->
11+
12+
An inbound `api` hook admitted a post only by ObjectStack's own `x-objectstack-signature`, so a vendor that signs its callbacks its own way (DocuSign Connect, a Stripe-style `t=…,v1=…` header, a GitHub-style `sha256=` header) could not be admitted at all. The start node's `config` now carries `signature`, which declares how such a sender signs:
13+
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+
- `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+
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.
18+
19+
New exports from `@objectstack/spec/automation`: `ApiTriggerSignatureSchema`, `ApiTriggerSignature`, `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.
20+
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.

‎content/docs/references/automation/api-trigger-secret-ref.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ refused as unavailable, never verified against nothing.
2626
The reference is NOT a credential: it is served with the definition like any
2727
other key, and only the literal `config.secret` is withheld on read.
2828

29+
It is also the key a third-party sender's declared scheme is verified under
30+
(`config.signature`, `api-trigger-signature.zod.ts`): one key per hook,
31+
whichever verifier the hook has.
32+
2933
Three refusals, each anchored on the start node's `config`:
3034

3135
- a reference that is not a name — `ApiTriggerSecretRefSchema`;
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
title: Api Trigger Signature — Automation Protocol
3+
navTitle: Api Trigger Signature
4+
description: "An inbound api hook's verifier for a THIRD-PARTY sender, declared. Reference for ApiTriggerBodySignature and 2 more: every property with its type and default."
5+
---
6+
7+
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
8+
9+
An inbound `api` hook's verifier for a THIRD-PARTY sender, declared.
10+
11+
An `api` flow's start node arms an inbound hook (ADR-0041 Tier 1, whose
12+
acceptance criteria name "HMAC signature verification (GitHub/Stripe style)
13+
and a constant-time compare"). By default the hook admits a post only by
14+
ObjectStack's own `x-objectstack-signature`: the timestamped HMAC-SHA256 of
15+
`<t>.<raw body>` under the hook's secret. A vendor that signs its callbacks
16+
its own way could not be admitted at all, whatever key it held: DocuSign
17+
Connect's `X-DocuSign-Signature-1` (base64 HMAC-SHA256 of the raw body), a
18+
Stripe-style `t=…,v1=…` header (hex HMAC-SHA256 of `<t>.<raw body>`), a
19+
GitHub-style `sha256=<hex>`. `config.signature` declares how such a sender
20+
signs: which header carries the digest, which HMAC, which encoding, and what
21+
is signed.
22+
23+
**The key is `config.secretRef`.** The same reference an ObjectStack-signed
24+
hook names, resolved the same way at every post: one key per hook, by name
25+
only. A vendor key is ⛔ never inline: a verifier beside a literal
26+
`config.secret` is refused, and so is one with no `secretRef` at all.
27+
28+
**One verifier per hook.** A declared `signature` REPLACES the
29+
`x-objectstack-signature` check for its hook. The hook then verifies the
30+
declared scheme and nothing else: it does not stack with the platform's own
31+
check, and it is not optional (a post without the declared header is refused
32+
like a post with a bad one). A start node with no `signature` is verified
33+
exactly as it was before this key. `apiTriggerVerifierOf` is the one
34+
reader that decides which verifier a hook has, and it decides on the key's
35+
PRESENCE: a `signature` that is present and unusable is never read as
36+
absent, so it can never fall back to the platform's check.
37+
38+
What the implementer owes (the constant-time compare, the replay window for
39+
a scheme that signs a timestamp and the absence of one for a scheme that
40+
does not, the one `401 INVALID_SIGNATURE` for every failure) is stated in
41+
`contracts/trigger-api-service.ts`, beside the platform's own verifier,
42+
because the member that verifies is declared there.
43+
44+
Refusals, each anchored on the start node's `config.signature`:
45+
46+
- a shape the schema refuses (`ApiTriggerSignatureSchema`): an
47+
unknown algorithm or encoding, a `signs` that is neither form, a
48+
`timestamp.body` scheme that names no timestamp source, a body-only
49+
scheme that names one, an undeclared key;
50+
- a `timestamp.body` scheme whose timestamp and digest are the same
51+
element of the header;
52+
- a verifier with no key reference (`config.secretRef` absent);
53+
- a verifier beside a literal `config.secret`: an inline key, and a second
54+
source for the one key the hook has;
55+
- a verifier on a flow that binds no inbound `api` trigger: nothing would
56+
ever read it.
57+
58+
This is the vocabulary ADR-0138 D7 left to a follow-up (F1: an HMAC, a
59+
timestamp, a replay window), placed on the signed inbound-hook channel
60+
rather than on `ApiEndpointSchema`.
61+
62+
<Callout type="info">
63+
**Source:** `packages/spec/src/automation/api-trigger-signature.zod.ts`
64+
</Callout>
65+
66+
## TypeScript Usage
67+
68+
```typescript
69+
import { ApiTriggerBodySignatureSchema, ApiTriggerSignatureSchema, ApiTriggerTimestampedSignatureSchema } from '@objectstack/spec/automation';
70+
import type { ApiTriggerBodySignature, ApiTriggerSignature, ApiTriggerTimestampedSignature } from '@objectstack/spec/automation';
71+
72+
// Validate data
73+
const result = ApiTriggerBodySignatureSchema.parse(data);
74+
```
75+
76+
---
77+
78+
## ApiTriggerBodySignature
79+
80+
A sender that signs the raw body alone (DocuSign Connect, a GitHub-style `sha256=` sender): the header value, after `prefix`, is the one digest. No replay window applies.
81+
82+
### Properties
83+
84+
| Property | Type | Required | Description |
85+
| :--- | :--- | :--- | :--- |
86+
| **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`. |
88+
| **algorithm** | `Enum<'hmac-sha256'>` | ✅ | The MAC the sender computes under the key `config.secretRef` names. `hmac-sha256` is the only one. |
89+
| **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+
| **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. |
91+
92+
93+
---
94+
95+
## ApiTriggerSignature
96+
97+
How a third-party sender signs its posts to this inbound hook, verified under the key `config.secretRef` names. Declared, it REPLACES the `x-objectstack-signature` check for this hook: the one verifier, never optional. A trigger that does not implement it refuses every post 401, never admits one unverified.
98+
99+
### Union Options
100+
101+
This schema accepts one of the following structures:
102+
103+
#### Option 1
104+
105+
A sender that signs the raw body alone (DocuSign Connect, a GitHub-style `sha256=` sender): the header value, after `prefix`, is the one digest. No replay window applies.
106+
107+
### Properties
108+
109+
| Property | Type | Required | Description |
110+
| :--- | :--- | :--- | :--- |
111+
| **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`. |
113+
| **algorithm** | `Enum<'hmac-sha256'>` | ✅ | The MAC the sender computes under the key `config.secretRef` names. `hmac-sha256` is the only one. |
114+
| **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+
| **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. |
116+
117+
---
118+
119+
#### Option 2
120+
121+
A sender that signs `<t>.<raw body>` and writes `t` beside the digest as `NAME=value` elements of one header (Stripe-style `t=…,v1=…`). The same replay window as `x-objectstack-signature` applies.
122+
123+
### Properties
124+
125+
| Property | Type | Required | Description |
126+
| :--- | :--- | :--- | :--- |
127+
| **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`. |
129+
| **algorithm** | `Enum<'hmac-sha256'>` | ✅ | The MAC the sender computes under the key `config.secretRef` names. `hmac-sha256` is the only one. |
130+
| **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+
| **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>`. |
132+
| **digestElement** | `string` | ✅ | The NAME of the header element that carries the digest (`v1`). A sender may send it more than once while it rolls its key; the post verifies when one of them matches. |
133+
134+
---
135+
136+
137+
---
138+
139+
## ApiTriggerTimestampedSignature
140+
141+
A sender that signs `<t>.<raw body>` and writes `t` beside the digest as `NAME=value` elements of one header (Stripe-style `t=…,v1=…`). The same replay window as `x-objectstack-signature` applies.
142+
143+
### Properties
144+
145+
| Property | Type | Required | Description |
146+
| :--- | :--- | :--- | :--- |
147+
| **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`. |
149+
| **algorithm** | `Enum<'hmac-sha256'>` | ✅ | The MAC the sender computes under the key `config.secretRef` names. `hmac-sha256` is the only one. |
150+
| **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+
| **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>`. |
152+
| **digestElement** | `string` | ✅ | The NAME of the header element that carries the digest (`v1`). A sender may send it more than once while it rolls its key; the post verifies when one of them matches. |
153+
154+
155+
---
156+

‎content/docs/references/automation/index.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Automation Protocol — schema reference
33
navTitle: Automation Protocol
4-
description: "The ObjectStack Automation Protocol in 15 reference pages: every schema in @objectstack/spec with its properties, types, defaults and a TypeScript example."
4+
description: "The ObjectStack Automation Protocol in 16 reference pages: every schema in @objectstack/spec with its properties, types, defaults and a TypeScript example."
55
---
66

77
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
@@ -10,6 +10,7 @@ This section contains all protocol schemas for the automation layer of ObjectSta
1010

1111
<Cards>
1212
<Card href="/docs/references/automation/api-trigger-secret-ref" title="Api Trigger Secret Ref" description="Source: packages/spec/src/automation/api-trigger-secret-ref.zod.ts" />
13+
<Card href="/docs/references/automation/api-trigger-signature" title="Api Trigger Signature" description="Source: packages/spec/src/automation/api-trigger-signature.zod.ts" />
1314
<Card href="/docs/references/automation/approval" title="Approval" description="Source: packages/spec/src/automation/approval.zod.ts" />
1415
<Card href="/docs/references/automation/assignment-rule" title="Assignment Rule" description="Source: packages/spec/src/automation/assignment-rule.zod.ts" />
1516
<Card href="/docs/references/automation/bpmn-interop" title="Bpmn Interop" description="Source: packages/spec/src/automation/bpmn-interop.zod.ts" />

‎content/docs/references/automation/meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"approval",
1515
"---More---",
1616
"api-trigger-secret-ref",
17+
"api-trigger-signature",
1718
"assignment-rule",
1819
"builtin-node-config",
1920
"flow-function",

‎content/docs/references/index.mdx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Protocol reference — every schema by module
33
navTitle: Protocol Reference
4-
description: Every schema published by @objectstack/spec — 1620 schemas across 14 protocol modules
4+
description: Every schema published by @objectstack/spec — 1623 schemas across 14 protocol modules
55
---
66

77
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
@@ -22,7 +22,7 @@ counts are sums of the rows they head. Regenerate with
2222
| :--- | ---: | ---: | :--- |
2323
| [AI Protocol](/docs/references/ai) | 12 | 68 | Agents, tools, skills, RAG and knowledge sources, model registry, conversations. |
2424
| [API Protocol](/docs/references/api) | 36 | 486 | REST contracts, endpoints, routing, realtime, batch, discovery. |
25-
| [Automation Protocol](/docs/references/automation) | 15 | 78 | Flows and their nodes, approvals, ETL pipelines, webhooks, state machines, execution records. |
25+
| [Automation Protocol](/docs/references/automation) | 16 | 81 | Flows and their nodes, approvals, ETL pipelines, webhooks, state machines, execution records. |
2626
| [Data Protocol](/docs/references/data) | 31 | 175 | Objects, fields, queries, filters, datasources and drivers — the ObjectQL layer. |
2727
| [Identity Protocol](/docs/references/identity) | 5 | 27 | Users and accounts, organizations, positions, SCIM provisioning. |
2828
| [Integration Protocol](/docs/references/integration) | 1 | 23 | The single connector protocol (ADR-0097) — catalog descriptors and provider-bound instances. |
@@ -34,7 +34,7 @@ counts are sums of the rows they head. Regenerate with
3434
| [Studio Protocol](/docs/references/studio) | 3 | 35 | Studio designer metadata — the authoring surfaces for the protocols above. |
3535
| [System Protocol](/docs/references/system) | 39 | 295 | The runtime environment — logging, jobs, cache, metrics, notifications, i18n and compliance. |
3636
| [UI Protocol](/docs/references/ui) | 16 | 175 | Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer. |
37-
| **Total** | **209** | **1620** | 14 protocol modules |
37+
| **Total** | **210** | **1623** | 14 protocol modules |
3838

3939
---
4040

@@ -110,13 +110,14 @@ REST contracts, endpoints, routing, realtime, batch, discovery.
110110

111111
## Automation Protocol
112112

113-
**Source:** `packages/spec/src/automation/` · **Import:** `@objectstack/spec/automation` · **15 pages, 78 schemas**
113+
**Source:** `packages/spec/src/automation/` · **Import:** `@objectstack/spec/automation` · **16 pages, 81 schemas**
114114

115115
Flows and their nodes, approvals, ETL pipelines, webhooks, state machines, execution records.
116116

117117
| File | Schemas |
118118
| :--- | :--- |
119119
| [`api-trigger-secret-ref.zod.ts`](/docs/references/automation/api-trigger-secret-ref) | `ApiTriggerSecretRef` |
120+
| [`api-trigger-signature.zod.ts`](/docs/references/automation/api-trigger-signature) | `ApiTriggerBodySignature`, `ApiTriggerSignature`, `ApiTriggerTimestampedSignature` |
120121
| [`approval.zod.ts`](/docs/references/automation/approval) | `ApprovalDecision`, `ApprovalEscalation`, `ApprovalNodeApprover`, `ApprovalNodeConfig`, `ApproverType`, `DecisionOutputDef` |
121122
| [`assignment-rule.zod.ts`](/docs/references/automation/assignment-rule) | `AssignmentRule`, `AssignmentRuleEntry`, `AssignmentStrategy`, `AssignmentTarget` |
122123
| [`bpmn-interop.zod.ts`](/docs/references/automation/bpmn-interop) | `BpmnDiagnostic`, `BpmnElementMapping`, `BpmnExportOptions`, `BpmnImportOptions`, `BpmnInteropResult`, `BpmnUnmappedStrategy`, `BpmnVersion` |

‎docs/audits/2026-07-unknown-key-strictness-ledger.counts/automation.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The `strict` column is the one the campaign schedules against; it counts both th
2121

2222
| Dir | Sites | strict | passthrough | catchall | strip |
2323
|---|---|---|---|---|---|
24-
| `automation/` | 66 | 42 | 0 | 1 | 23 |
24+
| `automation/` | 68 | 44 | 0 | 1 | 23 |
2525

2626
## `automation/` — sites
2727

@@ -31,6 +31,7 @@ classify and is not listed (it becomes reportable the day it grows its first sit
3131

3232
| File | Sites |
3333
|---|---|
34+
| `api-trigger-signature.zod.ts` | 2 |
3435
| `approval.zod.ts` | 4 |
3536
| `assignment-rule.zod.ts` | 3 |
3637
| `bpmn-interop.zod.ts` | 5 |
@@ -44,15 +45,15 @@ classify and is not listed (it becomes reportable the day it grows its first sit
4445
| `schemaless-node-config.zod.ts` | 4 |
4546
| `time-relative-trigger.zod.ts` | 1 |
4647
| `webhook.zod.ts` | 1 |
47-
| **total** | **66** |
48+
| **total** | **68** |
4849

4950
## `automation/` — open
5051

5152
Per file, how many of its sites still silently discard unknown keys. The `Class`
5253
column that decides the bucket split is hand-written in the ledger; the arithmetic
5354
over it is here.
5455

55-
**23 strip of 66**, in 5 file(s).
56+
**23 strip of 68**, in 5 file(s).
5657

5758
| File | Strip | Sites |
5859
|---|---|---|
@@ -61,7 +62,7 @@ over it is here.
6162
| `execution.zod.ts` | 12 | 12 |
6263
| `flow.zod.ts` | 1 | 11 |
6364
| `node-executor.zod.ts` | 4 | 4 |
64-
| **total** | **23** | **66** |
65+
| **total** | **23** | **68** |
6566

6667
| Bucket | Sites |
6768
|---|---|

0 commit comments

Comments
 (0)