@powerhousedao/switchboard 6.2.3-dev.8 → 6.2.3-dev.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tsbuild/test/attachments/byte-grants.test.d.ts +2 -0
- package/.tsbuild/test/attachments/byte-grants.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/byte-routes-read-gate.integration.test.d.ts +2 -0
- package/.tsbuild/test/attachments/byte-routes-read-gate.integration.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts +2 -0
- package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/url-signer.test.d.ts +2 -0
- package/.tsbuild/test/attachments/url-signer.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-auth-config.test.d.ts +2 -0
- package/.tsbuild/test/boot-auth-config.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-create-signature-policy.test.d.ts +2 -0
- package/.tsbuild/test/boot-create-signature-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-env-isolation.test.d.ts +2 -0
- package/.tsbuild/test/boot-env-isolation.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-helpers.d.ts +5 -0
- package/.tsbuild/test/boot-helpers.d.ts.map +1 -0
- package/.tsbuild/test/boot-inspection-enabled.test.d.ts +2 -0
- package/.tsbuild/test/boot-inspection-enabled.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-mcp-auth.test.d.ts +2 -0
- package/.tsbuild/test/boot-mcp-auth.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-mcp-enabled.test.d.ts +2 -0
- package/.tsbuild/test/boot-mcp-enabled.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-port-zero.test.d.ts +2 -0
- package/.tsbuild/test/boot-port-zero.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-preconditions.test.d.ts +2 -0
- package/.tsbuild/test/boot-preconditions.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-privacy.test.d.ts +2 -0
- package/.tsbuild/test/boot-privacy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-unsupported-stored-documents.test.d.ts +2 -0
- package/.tsbuild/test/boot-unsupported-stored-documents.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-without-renown.test.d.ts +2 -0
- package/.tsbuild/test/boot-without-renown.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-without-require-signatures.test.d.ts +2 -0
- package/.tsbuild/test/boot-without-require-signatures.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-worker-trust-policy.test.d.ts +2 -0
- package/.tsbuild/test/boot-worker-trust-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-workflow-singleton-conflict.test.d.ts +2 -0
- package/.tsbuild/test/boot-workflow-singleton-conflict.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-workflow-singleton-retry.test.d.ts +2 -0
- package/.tsbuild/test/boot-workflow-singleton-retry.test.d.ts.map +1 -0
- package/.tsbuild/test/builder-defaults.test.d.ts +2 -0
- package/.tsbuild/test/builder-defaults.test.d.ts.map +1 -0
- package/.tsbuild/test/config-from-env.test.d.ts +2 -0
- package/.tsbuild/test/config-from-env.test.d.ts.map +1 -0
- package/.tsbuild/test/config-merge.test.d.ts +2 -0
- package/.tsbuild/test/config-merge.test.d.ts.map +1 -0
- package/.tsbuild/test/config-schema.test.d.ts +2 -0
- package/.tsbuild/test/config-schema.test.d.ts.map +1 -0
- package/.tsbuild/test/create-signature-policy.test.d.ts +2 -0
- package/.tsbuild/test/create-signature-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/default-drive-protocol-versions.test.d.ts +2 -0
- package/.tsbuild/test/default-drive-protocol-versions.test.d.ts.map +1 -0
- package/.tsbuild/test/default-drive-slug.test.d.ts +2 -0
- package/.tsbuild/test/default-drive-slug.test.d.ts.map +1 -0
- package/.tsbuild/test/durable-node-fs-pg16.test.d.ts +2 -0
- package/.tsbuild/test/durable-node-fs-pg16.test.d.ts.map +1 -0
- package/.tsbuild/test/fatal-shutdown.test.d.ts +2 -0
- package/.tsbuild/test/fatal-shutdown.test.d.ts.map +1 -0
- package/.tsbuild/test/inspection-throttle.test.d.ts +2 -0
- package/.tsbuild/test/inspection-throttle.test.d.ts.map +1 -0
- package/.tsbuild/test/observability-signals.test.d.ts +2 -0
- package/.tsbuild/test/observability-signals.test.d.ts.map +1 -0
- package/.tsbuild/test/permissions-backfill.test.d.ts +2 -0
- package/.tsbuild/test/permissions-backfill.test.d.ts.map +1 -0
- package/.tsbuild/test/pglite-preflight.test.d.ts +2 -0
- package/.tsbuild/test/pglite-preflight.test.d.ts.map +1 -0
- package/.tsbuild/test/pglite-storage-dirs.test.d.ts +2 -0
- package/.tsbuild/test/pglite-storage-dirs.test.d.ts.map +1 -0
- package/.tsbuild/test/pglite-store.test.d.ts +2 -0
- package/.tsbuild/test/pglite-store.test.d.ts.map +1 -0
- package/.tsbuild/test/plugin-config-schemas.test.d.ts +2 -0
- package/.tsbuild/test/plugin-config-schemas.test.d.ts.map +1 -0
- package/.tsbuild/test/plugin-presence.test.d.ts +2 -0
- package/.tsbuild/test/plugin-presence.test.d.ts.map +1 -0
- package/.tsbuild/test/port-probe.test.d.ts +2 -0
- package/.tsbuild/test/port-probe.test.d.ts.map +1 -0
- package/.tsbuild/test/renown-storage-path.test.d.ts +2 -0
- package/.tsbuild/test/renown-storage-path.test.d.ts.map +1 -0
- package/.tsbuild/test/renown-trust-policy.test.d.ts +2 -0
- package/.tsbuild/test/renown-trust-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/served-schemas.test.d.ts +2 -0
- package/.tsbuild/test/served-schemas.test.d.ts.map +1 -0
- package/.tsbuild/test/shutdown.test.d.ts +2 -0
- package/.tsbuild/test/shutdown.test.d.ts.map +1 -0
- package/.tsbuild/test/snapshot-writer.d.ts +18 -0
- package/.tsbuild/test/snapshot-writer.d.ts.map +1 -0
- package/.tsbuild/test/store-lock.test.d.ts +2 -0
- package/.tsbuild/test/store-lock.test.d.ts.map +1 -0
- package/.tsbuild/test/two-switchboards.test.d.ts +2 -0
- package/.tsbuild/test/two-switchboards.test.d.ts.map +1 -0
- package/.tsbuild/test/unsupported-stored-documents.test.d.ts +2 -0
- package/.tsbuild/test/unsupported-stored-documents.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/harness.d.ts +56 -0
- package/.tsbuild/test/workflow/harness.d.ts.map +1 -0
- package/.tsbuild/test/workflow/oauth.test.d.ts +2 -0
- package/.tsbuild/test/workflow/oauth.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/resolvers.test.d.ts +2 -0
- package/.tsbuild/test/workflow/resolvers.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/runtime-host.test.d.ts +2 -0
- package/.tsbuild/test/workflow/runtime-host.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-dedupe.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-dedupe.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-signed.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-signed.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-trigger-test.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-trigger-test.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-unsigned.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-unsigned.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-reactor-access.test.d.ts +2 -0
- package/.tsbuild/test/workflow-reactor-access.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-reactor-enforcement.test.d.ts +2 -0
- package/.tsbuild/test/workflow-reactor-enforcement.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-read-gate.test.d.ts +2 -0
- package/.tsbuild/test/workflow-read-gate.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-runtime.test.d.ts +2 -0
- package/.tsbuild/test/workflow-runtime.test.d.ts.map +1 -0
- package/.tsbuild/test/workflows-plugin-config.test.d.ts +2 -0
- package/.tsbuild/test/workflows-plugin-config.test.d.ts.map +1 -0
- package/.tsbuild/tsconfig.tsbuildinfo +1 -1
- package/.tsbuild/tsdown.config.d.ts.map +1 -1
- package/.tsbuild/vitest.config.d.ts.map +1 -1
- package/Auth.md +144 -2
- package/CHANGELOG.md +1074 -0
- package/README.md +55 -14
- package/dist/boot.d.mts +46 -0
- package/dist/boot.d.mts.map +1 -0
- package/dist/boot.mjs +67 -0
- package/dist/boot.mjs.map +1 -0
- package/dist/config/from-env.d.mts +15 -0
- package/dist/config/from-env.d.mts.map +1 -0
- package/dist/config/from-env.mjs +4 -0
- package/dist/config/schema.d.mts +3 -0
- package/dist/config/schema.mjs +4 -0
- package/dist/from-env-BO0n9R02.mjs +401 -0
- package/dist/from-env-BO0n9R02.mjs.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +76 -79
- package/dist/index.mjs.map +1 -1
- package/dist/install-packages.d.mts +2 -1
- package/dist/install-packages.mjs +2 -2
- package/dist/install-packages.mjs.map +1 -1
- package/dist/mcp-SsBK14Jm.mjs +32 -0
- package/dist/mcp-SsBK14Jm.mjs.map +1 -0
- package/dist/migrate.d.mts +2 -1
- package/dist/migrate.mjs +7 -5
- package/dist/migrate.mjs.map +1 -1
- package/dist/plugin-host-C1sYEm8g.d.mts +46 -0
- package/dist/plugin-host-C1sYEm8g.d.mts.map +1 -0
- package/dist/plugins/attachments.d.mts +33 -0
- package/dist/plugins/attachments.d.mts.map +1 -0
- package/dist/plugins/attachments.mjs +4 -0
- package/dist/plugins/mcp.d.mts +31 -0
- package/dist/plugins/mcp.d.mts.map +1 -0
- package/dist/plugins/mcp.mjs +4 -0
- package/dist/plugins/privacy.d.mts +22 -0
- package/dist/plugins/privacy.d.mts.map +1 -0
- package/dist/plugins/privacy.mjs +4 -0
- package/dist/plugins/workflows.d.mts +79 -0
- package/dist/plugins/workflows.d.mts.map +1 -0
- package/dist/plugins/workflows.mjs +4 -0
- package/dist/postgres-url-DTDhBjXX.mjs +11 -0
- package/dist/postgres-url-DTDhBjXX.mjs.map +1 -0
- package/dist/privacy-BO8Q25xI.mjs +44 -0
- package/dist/privacy-BO8Q25xI.mjs.map +1 -0
- package/dist/privacy-DxIJGH4P.mjs +91 -0
- package/dist/privacy-DxIJGH4P.mjs.map +1 -0
- package/dist/renown-layers-COZsrGQT.mjs +40 -0
- package/dist/renown-layers-COZsrGQT.mjs.map +1 -0
- package/dist/schema-0g_QdOWn.mjs +267 -0
- package/dist/schema-0g_QdOWn.mjs.map +1 -0
- package/dist/schema-ivUWPQOn.d.mts +202 -0
- package/dist/schema-ivUWPQOn.d.mts.map +1 -0
- package/dist/server-cE1BWLQu.mjs +2518 -0
- package/dist/server-cE1BWLQu.mjs.map +1 -0
- package/dist/server.d.mts +270 -48
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +5 -5
- package/dist/utils-C6AIF38Z.mjs +133 -0
- package/dist/utils-C6AIF38Z.mjs.map +1 -0
- package/dist/utils.d.mts +12 -5
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +4 -3
- package/dist/worker-pool-BWHBLBJd.mjs +304 -0
- package/dist/worker-pool-BWHBLBJd.mjs.map +1 -0
- package/dist/workflow-runtime-7GaJ13c9.d.mts +30 -0
- package/dist/workflow-runtime-7GaJ13c9.d.mts.map +1 -0
- package/dist/workflows-COM3MKfD.mjs +1437 -0
- package/dist/workflows-COM3MKfD.mjs.map +1 -0
- package/package.json +68 -23
- package/scripts/install-packages.sh +0 -0
- package/test/attachment-reference-read-model.test.ts +28 -20
- package/test/attachments/auth.test.ts +85 -0
- package/test/attachments/byte-grants.test.ts +290 -0
- package/test/attachments/byte-routes-read-gate.integration.test.ts +314 -0
- package/test/attachments/download-target.test.ts +211 -32
- package/test/attachments/index.test.ts +47 -4
- package/test/attachments/reserve-metadata-parity.test.ts +96 -0
- package/test/attachments/routes-integration.test.ts +60 -4
- package/test/attachments/routes.test.ts +297 -35
- package/test/attachments/service-config.test.ts +41 -19
- package/test/attachments/url-signer.test.ts +105 -0
- package/test/boot-auth-config.test.ts +109 -0
- package/test/boot-create-signature-policy.test.ts +110 -0
- package/test/boot-env-isolation.test.ts +26 -0
- package/test/boot-helpers.ts +19 -0
- package/test/boot-inspection-enabled.test.ts +140 -0
- package/test/boot-mcp-auth.test.ts +449 -0
- package/test/boot-mcp-enabled.test.ts +119 -0
- package/test/boot-port-zero.test.ts +101 -0
- package/test/boot-preconditions.test.ts +200 -0
- package/test/boot-privacy.test.ts +232 -0
- package/test/boot-unsupported-stored-documents.test.ts +214 -0
- package/test/boot-without-renown.test.ts +83 -0
- package/test/boot-without-require-signatures.test.ts +76 -0
- package/test/boot-worker-trust-policy.test.ts +91 -0
- package/test/boot-workflow-singleton-conflict.test.ts +109 -0
- package/test/boot-workflow-singleton-retry.test.ts +122 -0
- package/test/builder-defaults.test.ts +80 -0
- package/test/config-from-env.test.ts +758 -0
- package/test/config-merge.test.ts +215 -0
- package/test/config-schema.test.ts +128 -0
- package/test/create-signature-policy.test.ts +69 -0
- package/test/default-drive-protocol-versions.test.ts +102 -0
- package/test/default-drive-slug.test.ts +97 -0
- package/test/durable-node-fs-pg16.test.ts +80 -0
- package/test/fatal-shutdown.test.ts +165 -0
- package/test/goldens/packages.graphql +797 -0
- package/test/goldens/privacy.graphql +853 -0
- package/test/goldens/reactor-drive-nodes.graphql +827 -0
- package/test/goldens/resolvers.json +322 -0
- package/test/goldens/supergraph.graphql +5652 -0
- package/test/goldens/workflow-runtime.graphql +1419 -0
- package/test/inspection-throttle.test.ts +23 -0
- package/test/observability-signals.test.ts +131 -0
- package/test/permissions-backfill.test.ts +486 -0
- package/test/pglite-dialect.test.ts +237 -2
- package/test/pglite-preflight.test.ts +313 -0
- package/test/pglite-storage-dirs.test.ts +113 -0
- package/test/pglite-store.test.ts +264 -0
- package/test/pglite-version.test.ts +9 -1
- package/test/plugin-config-schemas.test.ts +83 -0
- package/test/plugin-presence.test.ts +262 -0
- package/test/port-probe.test.ts +45 -0
- package/test/renown-storage-path.test.ts +40 -0
- package/test/renown-trust-policy.test.ts +313 -0
- package/test/served-schemas.test.ts +134 -0
- package/test/shutdown.test.ts +278 -0
- package/test/snapshot-writer.ts +94 -0
- package/test/store-lock.test.ts +65 -0
- package/test/two-switchboards.test.ts +146 -0
- package/test/unsupported-stored-documents.test.ts +72 -0
- package/test/worker-pool.test.ts +27 -1
- package/test/workflow/harness.ts +289 -0
- package/test/workflow/oauth.test.ts +205 -0
- package/test/workflow/resolvers.test.ts +369 -0
- package/test/workflow/runtime-host.test.ts +19 -0
- package/test/workflow/webhook-dedupe.test.ts +295 -0
- package/test/workflow/webhook-signed.test.ts +509 -0
- package/test/workflow/webhook-trigger-test.test.ts +82 -0
- package/test/workflow/webhook-unsigned.test.ts +345 -0
- package/test/workflow-reactor-access.test.ts +384 -0
- package/test/workflow-reactor-enforcement.test.ts +808 -0
- package/test/workflow-read-gate.test.ts +213 -0
- package/test/workflow-runtime.test.ts +1135 -0
- package/test/workflows-plugin-config.test.ts +77 -0
- package/tsconfig.json +11 -2
- package/tsdown.config.ts +12 -1
- package/vitest.config.ts +65 -0
- package/dist/server-CiKkVE6g.mjs +0 -1555
- package/dist/server-CiKkVE6g.mjs.map +0 -1
- package/dist/utils-Baw7rThP.mjs +0 -80
- package/dist/utils-Baw7rThP.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.config.d.ts","sourceRoot":"","sources":["../tsdown.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsdown.config.d.ts","sourceRoot":"","sources":["../tsdown.config.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":""}
|
package/Auth.md
CHANGED
|
@@ -133,6 +133,57 @@ interface AuthConfig {
|
|
|
133
133
|
- **Document Owners**: implicit ADMIN on documents they create
|
|
134
134
|
- **Per-Document Grants**: READ / WRITE / ADMIN granted to users or groups, inherited from protected ancestors
|
|
135
135
|
|
|
136
|
+
#### Attachments
|
|
137
|
+
|
|
138
|
+
An attachment is readable by whoever may read the document that references it.
|
|
139
|
+
`GET /attachments/:hash/download-target` decides that twice over: the caller
|
|
140
|
+
must be able to read the document's `global` scope, and the reference index
|
|
141
|
+
must confirm that the document really does reference this hash. A denial is a
|
|
142
|
+
single generic `404` either way, so it never tells the caller which of the two
|
|
143
|
+
failed.
|
|
144
|
+
|
|
145
|
+
Which model answers the first half is the deployment's choice, and by default it
|
|
146
|
+
is the permission tables above — unchanged.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Decide an attachment read with the referencing document's own policy
|
|
150
|
+
export ATTACHMENT_READS_FOLLOW_DOCUMENT_POLICY=true
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
With it on, the document's **own policy** decides, evaluated for the caller's
|
|
154
|
+
subject: their address *and* the `did:key` of the app instance whose token
|
|
155
|
+
authenticated them, because a grant can name either and a document's creator is
|
|
156
|
+
recorded by key. It needs a policy model to evaluate, which auth enforcement is
|
|
157
|
+
what supplies, and refuses to boot without one rather than leave the tables
|
|
158
|
+
deciding while the configuration says otherwise.
|
|
159
|
+
|
|
160
|
+
Why a deployment would want it: one whose documents carry policies keeps no rows
|
|
161
|
+
in the permission tables, so asking those tables about such a document returns
|
|
162
|
+
whatever the host-wide policy says — under `OPEN`, `true`, for every caller
|
|
163
|
+
including an anonymous one. Handing out bytes on that answer gives the file to
|
|
164
|
+
anyone who learns its hash, which the document's own state may well have told
|
|
165
|
+
them before their access was taken away.
|
|
166
|
+
|
|
167
|
+
Two things to know before turning it on. A document that carries **no** policy
|
|
168
|
+
stays readable, because an uninitialized policy is not a denial — unless the
|
|
169
|
+
host also sets `DEFAULT_PROTECTION`, which tells the gate to withhold what it
|
|
170
|
+
cannot decide, and then attachments on unpolicied documents are refused along
|
|
171
|
+
with everything else about them. And every non-browser client that downloads
|
|
172
|
+
bytes — an extraction worker, an indexer — needs a read grant of its own on the
|
|
173
|
+
documents it fetches, or it stops working the moment this is enabled.
|
|
174
|
+
|
|
175
|
+
The presigned URL a target carries is short-lived by design: the authorization
|
|
176
|
+
behind it is decided once, when it is issued, and the URL keeps working until it
|
|
177
|
+
expires however the policy changes in between. The default ceiling is **300
|
|
178
|
+
seconds**, and it applies whether or not the caller asked for a lifetime —
|
|
179
|
+
otherwise omitting `expiresIn` would be a way to opt out of it.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Raise it if a deployment genuinely needs longer; still bounded by the
|
|
183
|
+
# 7-day maximum a SigV4 signature can carry.
|
|
184
|
+
export ATTACHMENT_DOWNLOAD_TARGET_MAX_TTL_SECONDS=1800
|
|
185
|
+
```
|
|
186
|
+
|
|
136
187
|
### 6. **Session Management**
|
|
137
188
|
|
|
138
189
|
Advanced session handling with multiple active sessions:
|
|
@@ -221,6 +272,49 @@ It requires a caller to be resolvable at all, so it refuses to boot without
|
|
|
221
272
|
resolution off, no bearer is ever read and it would reject every caller,
|
|
222
273
|
including authenticated ones.
|
|
223
274
|
|
|
275
|
+
It also covers the attachment routes, which are mounted on the HTTP adapter and
|
|
276
|
+
never pass the GraphQL fetch chain. Their own 401 keys on `AUTH_ENABLED`, so
|
|
277
|
+
without this switch a deployment running `OPEN` serves them to anyone; with it,
|
|
278
|
+
every attachment route refuses a caller it cannot name — `download-target` and
|
|
279
|
+
the `GET`/`HEAD /attachments/:hash` byte routes included, even though they
|
|
280
|
+
decide per document (or by a signed URL) on their own. A filesystem signed
|
|
281
|
+
download URL therefore needs a bearer too while this switch is on.
|
|
282
|
+
|
|
283
|
+
##### Serving one path anonymously
|
|
284
|
+
|
|
285
|
+
Some products have a flow that runs *before* sign-in: previewing an invitation
|
|
286
|
+
from the code in its e-mail, for instance, so the screen can say who the
|
|
287
|
+
invitation is for. That flow has no caller by definition, and the floor above
|
|
288
|
+
would answer it a `401`.
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
export REQUIRE_AUTHENTICATED_CALLER=true
|
|
292
|
+
export REQUIRE_AUTHENTICATED_CALLER_EXEMPT_PATHS=/graphql/public
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Comma-separated, so several paths are one variable:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
export REQUIRE_AUTHENTICATED_CALLER_EXEMPT_PATHS=/graphql/public,/graphql/invites
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Each entry is matched against the request's **pathname, in full** — never as a
|
|
302
|
+
prefix, so `/graphql/public` does not also exempt `/graphql/public-admin`. A
|
|
303
|
+
trailing slash on either side is ignored; a leading slash is required, and a
|
|
304
|
+
path without one is refused at boot rather than left as an exemption that
|
|
305
|
+
silently never applies. Configuring exemptions while the floor is off is
|
|
306
|
+
refused too: it would describe a protection the server is not applying.
|
|
307
|
+
|
|
308
|
+
The exempt paths are named in the boot log, because the one question worth
|
|
309
|
+
asking about this floor is what is still open.
|
|
310
|
+
|
|
311
|
+
Every entry is a hole in it. Only ever name a path that serves operations which
|
|
312
|
+
are safe without a caller, and prefer a route mounted for exactly that purpose
|
|
313
|
+
over exempting one that also serves something else. Note what this switch does
|
|
314
|
+
**not** reach, in either configuration: routes registered directly on the HTTP
|
|
315
|
+
adapter (`/health`, `/ready`, `/explorer`, `/d/:drive`) and package HTTP routes,
|
|
316
|
+
which declare their own `auth` per route.
|
|
317
|
+
|
|
224
318
|
#### Configuration File Method
|
|
225
319
|
|
|
226
320
|
```json
|
|
@@ -266,8 +360,10 @@ for verification — but `url` still applies to this switchboard's own identity
|
|
|
266
360
|
Either way the credential's EIP-712 proof is re-verified and expiry and
|
|
267
361
|
delegation binding are re-checked, so a locally stored credential is held to the
|
|
268
362
|
same standard as a remote one. Successful checks are cached per identity for
|
|
269
|
-
`CREDENTIAL_VERIFICATION_CACHE_TTL_MS
|
|
270
|
-
|
|
363
|
+
`CREDENTIAL_VERIFICATION_CACHE_TTL_MS`. The default depends on the source: `0`
|
|
364
|
+
(no cache) for `self`, where the check is an in-process read-model query, and
|
|
365
|
+
60s for `remote`, where revocation lags by up to that TTL per replica. Setting
|
|
366
|
+
the env var overrides either default.
|
|
271
367
|
|
|
272
368
|
`self` requires a loaded package that provides the `renown-read-model` subgraph
|
|
273
369
|
(`@powerhousedao/renown-package`). Startup fails if none does, rather than booting
|
|
@@ -281,6 +377,52 @@ the generic `GraphQLManager.executeSubgraphQuery` plus an injectable
|
|
|
281
377
|
sets `source: "self"` without injecting a verifier is refused at boot rather
|
|
282
378
|
than silently verified against a remote Renown.
|
|
283
379
|
|
|
380
|
+
#### Revoking a Credential From a Package
|
|
381
|
+
|
|
382
|
+
A package that revokes credentials (for example a `revokeCredential` mutation)
|
|
383
|
+
should evict the host's cached check as soon as the revocation is stored, so the
|
|
384
|
+
credential is refused on the next request instead of after the cache TTL.
|
|
385
|
+
Every subgraph receives the invalidator as `SubgraphArgs.credentials`, and
|
|
386
|
+
`BaseSubgraph` exposes it as `this.credentials`:
|
|
387
|
+
|
|
388
|
+
```ts
|
|
389
|
+
class RenownAuthSubgraph extends BaseSubgraph {
|
|
390
|
+
resolvers = {
|
|
391
|
+
Mutation: {
|
|
392
|
+
revokeCredential: async (_: unknown, { id }: { id: string }) => {
|
|
393
|
+
const vc = await this.store.revoke(id); // persist first
|
|
394
|
+
// Evicts cached checks for this identity and re-verifies its open
|
|
395
|
+
// WebSocket connections. chainId and appDid narrow the eviction;
|
|
396
|
+
// pass only the address to drop every app key of that address.
|
|
397
|
+
this.credentials.invalidateCredential(
|
|
398
|
+
vc.address,
|
|
399
|
+
vc.chainId,
|
|
400
|
+
vc.appDid, // the did:key the credential delegates to
|
|
401
|
+
);
|
|
402
|
+
return true;
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
The call is synchronous, returns the number of evicted entries and is a no-op on
|
|
410
|
+
a host without authentication. It is local to the process: other replicas keep
|
|
411
|
+
their cache until its TTL lapses, which is why `source: "self"` defaults to no
|
|
412
|
+
cache.
|
|
413
|
+
|
|
414
|
+
Open WebSocket connections are authenticated once, at connect. Their credentials
|
|
415
|
+
are re-verified every `WS_CREDENTIAL_RECHECK_INTERVAL_MS` (default `60000`; `0`
|
|
416
|
+
turns the periodic sweep off) and immediately for the identity named by an
|
|
417
|
+
`invalidateCredential` call. A connection whose credential no longer verifies is
|
|
418
|
+
closed with code `4403` and reason `credential-revoked`. A re-check that fails
|
|
419
|
+
because the verifier is unreachable keeps the connection open. SSE subscription
|
|
420
|
+
streams are not re-checked.
|
|
421
|
+
|
|
422
|
+
A package built against an older `reactor-api` sees `this.credentials` as
|
|
423
|
+
`undefined`; call it as `this.credentials?.invalidateCredential(...)` when the
|
|
424
|
+
package must support such hosts.
|
|
425
|
+
|
|
284
426
|
#### The Switchboard's Own Identity
|
|
285
427
|
|
|
286
428
|
Separately from verifying incoming credentials, a switchboard has its own
|