Skip to content

Commit e8422d9

Browse files
committed
docs(connectors): the alipay-v3 scheme; ADR-0143 D2.3 and acceptance amendments; the changeset
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cxRP1AqTeP2PWAhwGK
1 parent db85f38 commit e8422d9

3 files changed

Lines changed: 102 additions & 9 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/service-automation': minor
4+
---
5+
6+
feat(spec): `alipay-v3` joins the `signed` connector-instance auth schemes, with response verification (ADR-0143 D2.3, #26710)
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: added
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) One member is added to the closed signing-scheme list and one shape to the `signed` union. The signer registry's third parameter changes from the key string to an object carrying the key and an optional vendor public key; that function is internal to the automation service and in no release yet (it ships with the pending `26710-signed-connector-auth-aliyun` changeset). Nothing an author wrote before is refused or re-shaped, so there is nothing for a migration to rewrite. -->
12+
13+
A declarative connector instance can now declare Alipay's OpenAPI v3 signature as its signing scheme. Its responses are verified too. It joins the Alibaba Cloud and Tencent Cloud schemes.
14+
15+
- **`@objectstack/spec`**
16+
- `ConnectorSigningSchemeSchema` gains `alipay-v3`.
17+
- The `signed` union gains its closed shape: `{ type: 'signed', scheme: 'alipay-v3', keyId, credentialRef, vendorPublicKeyRef }`.
18+
- `keyId` is the app id.
19+
- `credentialRef` names the application private key.
20+
- `vendorPublicKeyRef` names the Alipay public key that every response is verified with. It is required.
21+
- The same publish refusals apply as for the other schemes: inline key spellings by name, an authored `signature`, and `signed` on `provider: 'mcp'`. Also refused:
22+
- `appPrivateKey`, by name;
23+
- `alipayPublicKey`, which is answered with `vendorPublicKeyRef`.
24+
25+
`appId` is answered with `keyId`. An unknown scheme's refusal now lists all three schemes.
26+
- **`@objectstack/service-automation`**
27+
- Every request is signed `ALIPAY-SHA256withRSA` with a fresh nonce and timestamp.
28+
- Every response below status 400 must carry a valid Alipay signature, an empty body included. A signed error response is verified too. A response that fails either check fails the dispatch, and its body is never returned.
29+
- The vendor public key resolves through the same chain as `credentialRef`. An instance whose public key is missing is degraded with that reference named. The credential door lists both references against the instance.
30+
- A key that is not an RSA key fails boot, naming which reference, never the value.
31+
- The keys never leave the host.

‎content/docs/automation/connectors.mdx‎

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,9 @@ Some upstreams take no token at all: every request carries a signature over its
484484
own method, path, query, headers and body, computed with a key the caller never
485485
sends. The `signed` kind declares that (ADR-0143 D2.3). The metadata names the
486486
**scheme** and the public **key id**; the signing key itself is a
487-
`credentialRef`, resolved through the same chain as every other kind.
487+
`credentialRef`, resolved through the same chain as every other kind. A scheme
488+
whose vendor signs its responses also names the vendor's public key, as a
489+
second reference.
488490

489491
```ts
490492
// Alibaba Cloud OpenAPI, V3 signature (ACS3-HMAC-SHA256):
@@ -502,8 +504,22 @@ auth: {
502504
keyId: 'YourSecretId', // the SecretId: public, stays in metadata
503505
credentialRef: 'TENCENT_SECRET_KEY',
504506
}
507+
508+
// Alipay OpenAPI v3 (ALIPAY-SHA256withRSA), responses verified:
509+
auth: {
510+
type: 'signed',
511+
scheme: 'alipay-v3',
512+
keyId: '2021000000000000', // the app id: public, stays in metadata
513+
credentialRef: 'ALIPAY_APP_PRIVATE_KEY', // the application private key (RSA)
514+
vendorPublicKeyRef: 'ALIPAY_PUBLIC_KEY', // the Alipay public key responses are verified with
515+
}
505516
```
506517

518+
Both of an `alipay-v3` instance's references are listed against it by the
519+
credential door, and setting or replacing either one re-materializes it. The
520+
keys are accepted as Alipay's console issues them (the bare base64 body) or as
521+
PEM.
522+
507523
What the platform does with it:
508524

509525
- **Every request is signed, each attempt fresh.** A retry is signed again with
@@ -515,7 +531,8 @@ What the platform does with it:
515531
(`external.connector` is refused with `422`): a driver cannot sign per
516532
request.
517533
- **Schemes that sign their responses are verified** before a result is
518-
returned; a response that does not verify fails the dispatch.
534+
returned; a response that does not verify fails the dispatch, and its body
535+
never reaches the flow.
519536
- **`aliyun-acs3-hmac-sha256`** signs `host`, `content-type` and every
520537
`x-acs-*` header, and sets `x-acs-date`, `x-acs-signature-nonce`,
521538
`x-acs-content-sha256` and `Authorization`. The API's own action and version
@@ -526,9 +543,16 @@ What the platform does with it:
526543
the first label of the endpoint host (`cvm.tencentcloudapi.com`, or a
527544
regional `cvm.ap-guangzhou.tencentcloudapi.com`, is `cvm`), so point
528545
`baseUrl` at the product's own endpoint. `X-TC-Action`, `X-TC-Version` and
529-
`X-TC-Region` are yours to send and are not signed. A request without a body
530-
is sent with `Content-Type: application/x-www-form-urlencoded`, the type it
531-
is signed with.
546+
`X-TC-Region` are yours to send and are not signed. A request without a
547+
content type is sent with `Content-Type: application/x-www-form-urlencoded`,
548+
the type it is signed with.
549+
- **`alipay-v3`** signs the method, the path and query as sent and the body,
550+
with a fresh nonce and millisecond timestamp, and sets `Authorization:
551+
ALIPAY-SHA256withRSA app_id=…,nonce=…,timestamp=…,sign=…`. Every response
552+
below status 400 must carry a valid `alipay-signature` (an empty body too),
553+
checked against the key `vendorPublicKeyRef` names; an error response is
554+
verified when it is signed, and an unsigned one fails as the error it is.
555+
Public-key mode only: Alipay's certificate mode is not supported.
532556

533557
What the publish door refuses:
534558

@@ -537,9 +561,11 @@ What the publish door refuses:
537561
signer and its test vectors, so a scheme the server cannot run is never
538562
accepted.
539563
- **An inline key**: `secret`, `privateKey`, `secretKey` or `accessKeySecret`
540-
is refused by name, pointing at `credentialRef`. The vendors' words for the
541-
key id (`accessKeyId`, `secretId`) are answered with `keyId`. An authored `signature` is
542-
refused too: it is computed for every request.
564+
is refused by name, pointing at `credentialRef` (on `alipay-v3`,
565+
`appPrivateKey` too, and `alipayPublicKey` points at `vendorPublicKeyRef`).
566+
The vendors' words for the key id (`accessKeyId`, `secretId`, `appId`) are
567+
answered with `keyId`. An authored `signature` is refused too: it is computed
568+
for every request.
543569
- **`provider: 'mcp'`**, at `auth.type`: an MCP server is not signed per
544570
request. Declare `provider: 'rest'` or `provider: 'openapi'`.
545571

@@ -601,7 +627,9 @@ retry):
601627
| Invalid `providerConfig` (missing `baseUrl` / `spec` / `transport`, wrong shape) | **Hard boot error** from the provider factory |
602628
| `auth` is a grant-bearing kind (`oauth2`, `app-credential`) on a server that does not yet run its per-dispatch resolution | **Not fatal**: the instance registers **degraded**, naming the kind, and the upstream is never called without its credential; a datasource borrowing it is refused with `422` |
603629
| `auth` is `signed` on a provider that does not say it applies the request signer | **Hard boot error** naming the instance, the scheme and the provider: its calls would go out unsigned — declare it through `rest` or `openapi` |
604-
| `credentialRef` resolves to nothing | **Not fatal**: the instance registers **degraded**, naming the reference — set it (`PUT …/credential-refs/:ref`), and it materializes without a restart |
630+
| `credentialRef` (or a `signed` instance's `vendorPublicKeyRef`) resolves to nothing | **Not fatal**: the instance registers **degraded**, naming the reference — set it (`PUT …/credential-refs/:ref`), and it materializes without a restart |
631+
| A `signed` reference resolves to something that is not a key of the scheme's kind (an `alipay-v3` key that is not RSA) | **Hard boot error** naming the instance and which reference cannot sign or verify, never the value |
632+
| A response to an `alipay-v3` call is unsigned (below status 400) or its signature does not verify | The dispatch **fails** naming the instance and the status; the response's body is never returned |
605633
| The upstream refuses the credential (`401` / `403`) | **Not fatal**: the instance registers **degraded**. A stored credential is marked `rejected` and waits until it is set again (or a restart); an environment or vault credential is retried on the backoff |
606634
| Instance `name` collides with a plugin-registered connector | **Hard boot error** — there is no silent precedence between the two worlds |
607635
| stdio transport without host opt-in | **Hard boot error** with the `declarativeStdio` fix inline — a security rejection is never retried |

‎docs/adr/0143-outbound-connector-auth-is-open-tier.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,34 @@ carry and forbid; exact key spelling is the spec slice's, reviewed against this
179179
(Q4). A "generic HMAC" member is admitted only with a
180180
canonical form pinned in the spec; without one, it is a dialect.
181181

182+
> **Amended (2026-10-31, #26710) — Alipay's vectors, and which responses it verifies.** The maintainer
183+
> ruled on 2026-10-31, verbatim: 「其他同意」 (accepting option B of the director decision on S3's test
184+
> vectors) and 「算」 (the local end-to-end test counts as the acceptance below).
185+
>
186+
> - **A third branch of the vector rule.** A vendor may publish neither a complete worked example nor
187+
> a byte-exact vector in an official SDK test suite. The vectors are then produced by running two of
188+
> the vendor's official SDKs over one placeholder key that belongs to no account, and they are
189+
> admitted only when the two agree byte for byte. The test names both SDKs and their versions, and the
190+
> generator and the placeholder key are kept in the repository, so anyone can re-run the check. RSA
191+
> PKCS#1 v1.5 signatures are deterministic, so agreement is exact, not approximate.
192+
> - **Alipay takes that branch.** On 2026-10-31 no official v3 SDK test suite carried a byte-exact
193+
> vector (Java v3, PHP v3, .NET v3 and the Node SDK were checked). The vendor's signature pages could
194+
> not be reached to look for a worked example with a usable key, and the maintainer ruled that this is
195+
> not a gate. `alipay-v3`'s vectors come from `com.alipay.sdk:alipay-sdk-java-v3:3.1.89.ALL` and
196+
> `alipay-sdk` 4.14.0 (Node); the generator is
197+
> `packages/services/service-automation/test-vectors/alipay-v3/`.
198+
> - **Which responses `alipay-v3` verifies is a deliberate choice, because the two SDKs disagree.**
199+
> Java v3 3.1.89 verifies a 2xx response unless its body is empty, and verifies an error response
200+
> only when it carries `alipay-signature`. Node 4.14.0 verifies every response below status 400,
201+
> including an empty body, and never verifies an error response. The platform takes the stricter rule
202+
> in each case: every response below 400 must carry a valid signature, an empty body included, and an
203+
> error response is verified when it is signed. An unsigned error response fails as the error it
204+
> already is. The rule is one function in the signer (`alipayV3ResponseMustVerify`), so a different
205+
> ruling changes one line.
206+
> - The vendor public key is the instance's `vendorPublicKeyRef`, the "vendor public-key
207+
> `credentialRef`" this decision names. It resolves through the same chain as `credentialRef`, and
208+
> an instance whose public key does not resolve is degraded, not served unverified.
209+
182210
### D3 — Secrets are references; tokens are runtime state in a connection record
183211

184212
- Every secret an author names is a `credentialRef`, resolved through `CredentialResolver` (ADR-0097 §3,
@@ -418,6 +446,12 @@ platform public key rather than rotating certificates, but the response-verifica
418446
- An `openapi` instance over the Alipay v3 document, normalized to JSON first, with
419447
`auth: { type: 'signed', scheme: 'alipay-v3', … }`, dispatches a sandbox query over https and
420448
verifies the response signature. Signer unit tests meet D2.3's vector rule.
449+
> **Amended (2026-10-31, #26710).** The maintainer ruled 「算」: a local end-to-end test counts as this
450+
> line, and no live sandbox call is owed. In that test, an `openapi` instance over the vendor's
451+
> `alipay.trade.query` operation dispatches through a flow `connector_action` to a local stand-in for
452+
> the gateway. The stand-in checks the request signature and signs its answer, and a tampered or
453+
> unsigned answer fails the dispatch. The test is
454+
> `packages/connectors/connector-openapi/src/alipay-v3-acceptance.test.ts`.
421455
- `client_credentials` and the dynamic-registration flow pass a contract test against the embedded
422456
OAuth authorization server.
423457
- An unknown `grant`, `vendor` or `scheme`, or an inline secret on any variant, is refused at publish

0 commit comments

Comments
 (0)