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 0b82ff3
Browse filesBrowse the repository at this point in the historyBrowse files
feat(trigger-api): an `api` hook verifies the vendor signature its start node declares (`config.signature`)
8
+
9
+
Clause-②: yes (widening)
10
+
Metadata-protocol: none
11
+
12
+
- **`@objectstack/trigger-api`.** `start()` reads the hook's one verifier with `apiTriggerVerifierOf(binding.config)` (`@objectstack/spec/automation`). A start node that declares its sender's scheme (`config.signature`: DocuSign Connect's base64 `X-DocuSign-Signature-1`, a Stripe-style `t=…,v1=…`, a GitHub-style `sha256=`) now admits a correctly signed post that was answered `401` before. That scheme REPLACES the `x-objectstack-signature` check for its hook: the declared header is read on both faces of the door (the self-hosted mount and `handleInboundHook`) with `Headers.get`, so a repeated field is its one joined value; the HMAC-SHA256 is computed under the key `config.secretRef` names (read at every post through the engine's reader, `503` while it has no value), over the raw body or `<t>.<raw body>`; each digest is decoded strictly to 32 bytes and compared with `timingSafeEqual`, any one of several `v1` elements matching (a key roll); and a timestamped scheme is held to `HTTP_SIGNATURE_TOLERANCE_SECONDS` from `@objectstack/core`. A body-only scheme has no replay window, as the contract states. A valid `x-objectstack-signature` admits nothing on such a hook, and a post without the declared header is refused. A declaration the spec answers `unusable` arms a hook that refuses every post before any secret is read and never falls back to `x-objectstack-signature`; a declared scheme bound without the engine's `config.secretRef` reader is refused at `start()`. Every failure is the same `401 INVALID_SIGNATURE` with its own cause in the server log (`declared-header-absent`, `declared-header-malformed`, `declared-prefix-missing`, `declared-no-digest`, `declared-mismatch`, `declared-outside-window`, `declared-unusable`), never the key, the header value or the body. A hook that declares no scheme is verified exactly as before.
13
+
-**`@objectstack/lint`.**`validateFlowApiTriggerSecret` grades an `api` hook by that same reader: a usable declaration is ready on its `config.secretRef` alone, and an unusable one is the new error `flow-api-trigger-signature-unusable` (with its `os explain` entry), located at the key the spec refuses. It fires only on a declaration the flow parse already refuses, so no stack that passed before is refused now.
14
+
-**`@objectstack/skills`.** The automation and api skills teach `config.signature` where they said a vendor-signed callback cannot be admitted.
Copy file name to clipboardExpand all lines: content/docs/automation/flows.mdx
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -575,6 +575,57 @@ would send.
575
575
A flow definition, including an `http` node's `url` and `headers`, is served to every member who can read flows. A token, API key or signed webhook url written there is readable by all of them. Route an outbound credential by where it sits, and call the connector with a `connector_action` node instead — see [Connectors](/docs/automation/connectors#authentication). A credential in a header goes to a declarative connector with `bearer`, `basic` or `api-key` auth, whose `auth.credentialRef` names the secret. A key in the query string goes to `api-key` auth with `paramName`. No `credentialRef` variant carries a secret in the url path, so an incoming-webhook url (whose path is the secret) cannot be routed that way: call the service through a token-authenticated connector instead, such as the `slack` connector, whose bot token is supplied to the plugin by host code rather than written in the flow (it is registered by that plugin, not declared as a `connectors:` instance). Otherwise such a url is served with the definition. Only `signingSecret` and a start node's `secret` are kept out of a flow saved through the metadata API: the metadata save door stores each in a write-only, encrypted flow credential store, a read never returns it, and the engine reads it only to verify an inbound post or sign an outbound request. A flow that ships in a package names its inbound hook secret instead of carrying it: the start node's `config.secretRef` holds the name the deployment fills (an environment variable of that name in the open tier, resolved through the same credential resolver as a connector's `auth.credentialRef`), and the engine reads it at every post, so no credential is published with the package. A post that arrives while the name has no value is answered `503`, never verified. The reference is a name, not a credential: it is served as written, it may not sit beside a literal `secret`, and it may not name a variable in the platform's `OS_` namespace. A packaged flow that carries a literal keeps it in its package source; the literal is withheld when the definition is served, and a credential store row for that flow, where one exists, wins when the engine verifies or signs. `url` and `headers` are stored and served as written.
576
576
</Callout>
577
577
578
+
#### An inbound hook that verifies its sender's own signature — `config.signature`
579
+
580
+
By default an `api` flow's hook admits a post only by ObjectStack's own
581
+
`x-objectstack-signature`. A vendor that signs its callbacks its own way
582
+
(DocuSign Connect's `X-DocuSign-Signature-1`, a Stripe-style `t=…,v1=…`
583
+
header, a GitHub-style `sha256=` header) is admitted by declaring how it signs
584
+
on the start node, as `config.signature`, beside the `config.secretRef` that
`signs` says what the sender signs, and picks the form:
603
+
604
+
|`signs`| The sender signs | The header carries | Replay window |
605
+
|:--|:--|:--|:--|
606
+
|`body`| the raw body alone (DocuSign Connect; GitHub-style with `prefix: 'sha256='`) | the one digest, after `prefix` when one is declared | none: the sender signs no time, so a captured post verifies again while the key is unchanged |
607
+
|`timestamp.body`|`<t>.<raw body>` (Stripe-style) |`NAME=value` elements: one `timestampElement` (`t`) and one or more `digestElement`s (`v1`, one per key while the sender rolls its key) | the same 300 seconds as `x-objectstack-signature`|
608
+
609
+
`header` is matched without regard to case; a field the sender repeats is
610
+
read as its one value, the copies joined with `, `, so a body-only header sent
611
+
twice does not verify. `algorithm` is `hmac-sha256`, `encoding` is `hex` or
612
+
`base64`, and the digest must decode to the 32 bytes of the HMAC, compared in
613
+
constant time over the body exactly as received. The key is only ever the one
614
+
`config.secretRef` names, read at every post like any hook secret (`503` while
615
+
it has no value); a literal `secret` beside `signature` is refused.
616
+
617
+
A declared scheme **replaces** the `x-objectstack-signature` check for its hook:
618
+
the hook has that one verifier, so a post that carries only a valid
619
+
`x-objectstack-signature` is refused, and so is one without the declared
620
+
header. Every refusal is the same `401 INVALID_SIGNATURE` an unsigned post
621
+
gets, with its cause in the server log only. A declaration the flow parse
622
+
refuses (an unknown algorithm, a reserved header such as `authorization` or
623
+
`x-objectstack-signature`, a timestamped scheme without its elements) never
624
+
falls back to the platform check: `os validate` reports it as
625
+
`flow-api-trigger-signature-unusable`, and a hook armed with it admits no post.
Copy file name to clipboardExpand all lines: packages/spec/variant-docs.json
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -212,8 +212,10 @@
212
212
{
213
213
"key": "signs:body|timestamp.body",
214
214
"label": "api trigger declared signature scheme",
215
-
"exempt": "generated-reference-only",
216
-
"reason": "An api flow start node's `config.signature` (#29983, the contract half): content/docs/references/automation/api-trigger-signature.mdx is generated from ApiTriggerSignatureSchema. No hand-written guide teaches it yet on purpose: the api trigger does not verify the key until the domain:server slice lands, so a guide written now would teach a hook that refuses every post. That slice writes the automation/flows.mdx section naming `body` and `timestamp.body` beside the `secretRef` paragraph and binds it here, replacing this exemption."
215
+
"docs": [
216
+
"content/docs/automation/flows.mdx"
217
+
],
218
+
"note": "An api flow start node's `config.signature` (#29983; the trigger verifies it since #30009). automation/flows.mdx teaches both forms beside the `secretRef` paragraph, in its `signs` table."
Copy file name to clipboardExpand all lines: skills/objectstack-api/SKILL.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,16 +129,18 @@ policy layer over an existing pipeline, never a second execution dialect.
129
129
|**`defineStack({ apis })`**| The endpoint is a *projection* of something the platform already executes: query/return records, or trigger a flow. No code, no deploy artifact, publish-gated. **Prefer this.**|
130
130
|**A flow that runs your code**| The endpoint needs real handler CODE: point a `type: 'flow'` endpoint at a flow whose `script` node names a stack function (`defineStack({ functions })`), or whose `connector_action` node calls a declared connector (outbound). The URL stays declarative; the code runs where the automation surface already runs it. |
131
131
132
-
An inbound webhook from a sender you control is a `type: 'api'` flow
133
-
(objectstack-automation → **Inbound webhook (`api`) triggers**): it verifies
134
-
ObjectStack's own `x-objectstack-signature`, enqueues, and answers `202`.
132
+
An inbound webhook is a `type: 'api'` flow (objectstack-automation →
133
+
**Inbound webhook (`api`) triggers**): it verifies ObjectStack's own
134
+
`x-objectstack-signature`, or a vendor's own HMAC-SHA256 header its start node
135
+
declares as `config.signature` (DocuSign Connect, Stripe-style), enqueues, and
136
+
answers `202`.
135
137
**An app never mounts on `http.server`** — that service is the platform
136
138
plugins' own door-building primitive, and a code-mounted route gets no caller
137
139
identity, auth gate, rate limit, namespace carve-out or OpenAPI entry. Three
138
140
cases have no app surface today; say so rather than invent one: a third-party
139
-
callback verified by its own signature over the raw body (the hook checks only
140
-
`x-objectstack-signature`), a streaming response (a declared endpoint answers
141
-
one JSON envelope), and a protocol the platform does not speak.
141
+
callback signed in a form `config.signature` cannot declare (not HMAC-SHA256),
142
+
a streaming response (a declared endpoint answers one JSON envelope), and a
Copy file name to clipboardExpand all lines: skills/objectstack-automation/SKILL.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -355,7 +355,7 @@ node `config`**:
355
355
|`hookId`| URL path token (default `'default'`). **Rotate it to revoke** a leaked endpoint |
356
356
|`secretRef` / `secret`| HMAC-SHA256 secret, **one required** (else refused at registration and `os validate`). Ship `secretRef: 'NAME'`: an env var the deployment fills, not `OS_*`; unfilled ⇒ `503`. Never a literal |
357
357
358
-
-**Signature:**`x-objectstack-signature: t=<unix seconds>,v1=<hex>` — `v1` = HMAC-SHA256 of `<t>.<raw body>` under the secret; refused when `t`is over 300 s from the server clock.
358
+
-**Signature:**`x-objectstack-signature: t=<unix seconds>,v1=<hex>` — HMAC-SHA256 of `<t>.<raw body>`; `t`within 300 s. Vendor-signed: `config.signature` replaces it (recipe 4).
359
359
-**Idempotency:**`x-idempotency-key` dedupes retries — author the flow to be idempotent (delivery is at-least-once).
360
360
-**Queue-backed:** the endpoint ACKs `202` and enqueues; the flow runs on the consumer.
361
361
- The JSON body surfaces to the flow as the trigger record (`record.*` / bare fields) plus `params`.
0 commit comments