workflow 4.8.10 → 4.8.12

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.
@@ -23,7 +23,7 @@ These APIs are available but are **seeded or fixed** to ensure deterministic beh
23
23
  | API | Behavior |
24
24
  |-----|----------|
25
25
  | [`Math.random()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random) | Seeded random number generator — same seed produces the same sequence every replay |
26
- | [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) / `Date.now()` / `new Date()` | Returns a fixed timestamp that advances with the workflow's logical clock |
26
+ | [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) / `Date.now()` / `new Date()` | Returns the workflow's logical clock: the run's creation time until the first step result, hook payload, hook registration or wait completion reaches the workflow, then the time that event was recorded, advancing as each later one is delivered. Identical on every replay of the same log |
27
27
  | [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) | Seeded — produces deterministic output for a given workflow run |
28
28
  | [`crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID) | Seeded — produces deterministic UUIDs for a given workflow run |
29
29
  | [`crypto.subtle.digest()`](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest) | Passes through to the real implementation (SHA-256, etc. are deterministic by nature) |
@@ -19,7 +19,7 @@ A **World** is the abstraction that allows workflows to run on any infrastructur
19
19
  </Callout>
20
20
 
21
21
  <Callout type="info">
22
- **Reference Implementation:** The [Postgres World source code](https://github.com/vercel/workflow/tree/main/packages/world-postgres) is a production-ready example of how to implement the World interface with a database backend and graphile-worker for queuing.
22
+ **Reference Implementation:** The [Postgres World source code](https://github.com/vercel/workflow/tree/main/packages/world-postgres) is a complete example of how to implement the World interface with a database backend and graphile-worker for queuing. It is not optimized for scale, speed, or security and should be used as a reference to fill in those gaps in a custom World. Please see the [Postgres World docs](/docs/deploying/world/postgres-world) for what a self-hosted World has to gate itself.
23
23
  </Callout>
24
24
 
25
25
  ## What is a World?
@@ -86,4 +86,4 @@ The local world is designed for development, not production:
86
86
  - **Single instance** - Cannot handle distributed deployments
87
87
  - **No authentication** - Suitable only for local development
88
88
 
89
- For production deployments, use the [Vercel World](/worlds/vercel) or [Postgres World](/worlds/postgres).
89
+ For production deployments, use the [Vercel World](/worlds/vercel), which handles execution, persistence, multi-tenancy, scale, observability, and security for you on Vercel, or check out the [Postgres World](/worlds/postgres) - a tested reference implementation that implements the complete World spec and can be used to deploy workflows anywhere.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Postgres World
3
- description: Production-ready, self-hosted world using PostgreSQL for storage and graphile-worker for job processing.
3
+ description: Self-hosted reference world using PostgreSQL for storage and graphile-worker for job processing.
4
4
  type: integration
5
5
  summary: Deploy workflows to your own infrastructure using PostgreSQL and graphile-worker.
6
6
  prerequisites:
@@ -10,10 +10,20 @@ related:
10
10
  - /docs/deploying/world/vercel-world
11
11
  ---
12
12
 
13
- The Postgres World is a production-ready backend for self-hosted deployments. It uses PostgreSQL for durable storage and [graphile-worker](https://github.com/graphile/worker) for reliable job processing.
13
+ The Postgres World is a self-hosted backend that uses PostgreSQL for durable storage and [graphile-worker](https://github.com/graphile/worker) for reliable job processing.
14
14
 
15
15
  Use the Postgres World when you need to deploy workflows on your own infrastructure outside of Vercel - such as a Docker container, Kubernetes cluster, or any cloud that supports long-running servers.
16
16
 
17
+ <Callout type="warn">
18
+ The Postgres World is a **reference implementation**: it implements the
19
+ complete World spec and is tested, but it is not optimized for scale, speed,
20
+ or security, and it ships with **no authentication** on the workflow HTTP
21
+ routes. For production use-cases we recommend cloning it and adapting it to
22
+ your persistence, network stack, scale, and security requirements. If you
23
+ deploy it as is, you must restrict those routes yourself. Read
24
+ [Security](#security) first.
25
+ </Callout>
26
+
17
27
  ## Installation
18
28
 
19
29
  Install the Postgres World package in your workflow project:
@@ -232,6 +242,34 @@ The Postgres World uses PostgreSQL as a durable backend:
232
242
 
233
243
  This architecture ensures workflows survive application restarts with all state reliably persisted. For implementation details, see the [source code](https://github.com/vercel/workflow/tree/main/packages/world-postgres).
234
244
 
245
+ ## Security
246
+
247
+ Unlike the [Vercel World](/worlds/vercel), which authenticates and [encrypts](/docs/how-it-works/encryption) workflow traffic automatically, the Postgres World does **not** automatically authenticate requests that drive workflow execution. Adding that is your responsibility and should be in place before an app using this World is used in production and reachable by untrusted clients. We also recommend [enabling encryption](/docs/how-it-works/encryption#custom-world-implementations).
248
+
249
+ ### Protect the queue route
250
+
251
+ `POST /.well-known/workflow/v1/flow` is where the worker delivers workflow orchestration and queued step invocations. It is mounted in your application like any other route, so it is publicly reachable by default, and it accepts any request whose headers and body are well-formed: there is no signature, shared secret, or caller check. Anyone who can reach it can forge or replay a workflow or step invocation, including steps your application would only reach after its own gating. Restrict it before you expose the app.
252
+
253
+ The other routes under `/.well-known/workflow/v1/` differ:
254
+
255
+ - `webhook/:token`, created by [`createWebhook()`](/docs/api-reference/workflow/create-webhook), is authorized by the token in the URL and nothing else. Use [`createHook()`](/docs/api-reference/workflow/create-hook) behind your own authenticated route and [`resumeHook()`](/docs/api-reference/workflow-api/resume-hook) when you need more than that.
256
+ - `manifest.json` responds with `404` unless the app was built with `WORKFLOW_PUBLIC_MANIFEST=1`. That variable is read at build time, so unsetting it in the runtime environment of an already-built deployment does not withdraw the manifest. Leave it unset outside of testing, because the manifest lists your workflow and step names.
257
+
258
+ ### Bringing your own auth
259
+
260
+ Workflow does not prescribe an auth mechanism for self-hosted Worlds, so restrict the flow route at the network edge rather than inside the application:
261
+
262
+ - **Keep the flow route unreachable from outside.** By default the worker delivers to a loopback address (`http://localhost:{PORT}`, or `WORKFLOW_LOCAL_BASE_URL` when set), so in the common single-process topology nothing outside the container needs to reach it. Blocking external requests to `/.well-known/workflow/v1/flow` at your ingress, reverse proxy, or firewall costs you nothing, because loopback delivery never traverses that layer. Do not block the whole `/.well-known/workflow/` prefix if you use [`createWebhook()`](/docs/api-reference/workflow/create-webhook): its `webhook/:token` route sits under the same prefix and has to stay reachable by whoever calls it.
263
+ - **Authenticate at the proxy when the routes must cross hosts.** If your web tier and workers are separate deployments, require mTLS or a shared-secret header at the proxy in front of the application, and strip any client-supplied copy of that header at the edge.
264
+ - **Do not gate these paths in framework middleware.** The [Next.js setup guide](/docs/getting-started/next) tells you to exclude `/.well-known/workflow/*` from your proxy matcher, because a handler that consumes the internal request body breaks execution. Adding the paths back in order to gate them reintroduces that failure mode.
265
+ - **Do not expect the World to present a credential.** It does not sign its delivery requests or attach a secret to them, so an in-application check that requires one will reject the World's own deliveries.
266
+
267
+ ### Data at rest
268
+
269
+ The Postgres World does not currently implement `getEncryptionKeyForRun()`, so it does not participate in Workflow's [end-to-end encryption](/docs/how-it-works/encryption): workflow and step inputs and return values, hook payloads and metadata, and stream chunks are all stored in your database in readable form. A World derived from this one can opt in by implementing that one method; see [Custom World implementations](/docs/how-it-works/encryption#custom-world-implementations). Until then, protect the database, its credentials, and its backups accordingly.
270
+
271
+ The [observability UI](/docs/observability) has no authentication of its own either. If you self-host `@workflow/web` against your Postgres database, put it behind your own auth layer, because everyone who can reach it can read every run.
272
+
235
273
  ## Deployment
236
274
 
237
275
  Deploy your application to any cloud that supports long-running servers:
@@ -245,6 +283,7 @@ Ensure your deployment has:
245
283
  1. Network access to your PostgreSQL database
246
284
  2. Environment variables configured correctly
247
285
  3. The `start()` function called on server initialization
286
+ 4. `/.well-known/workflow/v1/flow` restricted so untrusted clients cannot reach it (see [Security](#security))
248
287
 
249
288
  <Callout type="info">
250
289
  The Postgres World is not compatible with Vercel deployments. On Vercel, workflows automatically use the [Vercel World](/worlds/vercel) with zero configuration.
@@ -252,6 +291,9 @@ The Postgres World is not compatible with Vercel deployments. On Vercel, workflo
252
291
 
253
292
  ## Limitations
254
293
 
294
+ - **Reference implementation** - Tested and implements the complete World spec, but is not optimized for scale, speed, or security; a production deployment typically clones it and adapts it, or runs workers in separate processes with a more robust queuing system
295
+ - **No built-in authentication** - The workflow HTTP routes accept any request that reaches them; you must restrict them yourself (see [Security](#security))
296
+ - **No encryption** - Workflow and step data is stored unencrypted; the World does not currently implement [end-to-end encryption](/docs/how-it-works/encryption)
255
297
  - **Requires long-running process** - Must call `start()` on server initialization; not compatible with serverless platforms
256
298
  - **PostgreSQL infrastructure** - Requires a PostgreSQL database (self-hosted or managed)
257
299
  - **Not compatible with Vercel** - Use the [Vercel World](/worlds/vercel) for Vercel deployments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workflow",
3
- "version": "4.8.10",
3
+ "version": "4.8.12",
4
4
  "description": "Workflow SDK - Build durable, resilient, and observable workflows",
5
5
  "main": "dist/typescript-plugin.cjs",
6
6
  "type": "module",
@@ -57,18 +57,18 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "ms": "2.1.3",
60
- "@workflow/astro": "4.0.25",
61
- "@workflow/cli": "4.3.14",
62
- "@workflow/core": "4.8.10",
60
+ "@workflow/astro": "4.0.27",
61
+ "@workflow/cli": "4.3.16",
62
+ "@workflow/core": "4.8.12",
63
63
  "@workflow/errors": "4.2.2",
64
64
  "@workflow/typescript-plugin": "4.0.3",
65
+ "@workflow/next": "4.1.16",
66
+ "@workflow/nest": "4.0.28",
67
+ "@workflow/nitro": "4.1.18",
68
+ "@workflow/nuxt": "4.0.28",
69
+ "@workflow/sveltekit": "4.0.27",
65
70
  "@workflow/utils": "4.1.4",
66
- "@workflow/next": "4.1.14",
67
- "@workflow/nest": "4.0.26",
68
- "@workflow/nitro": "4.1.16",
69
- "@workflow/nuxt": "4.0.26",
70
- "@workflow/sveltekit": "4.0.25",
71
- "@workflow/rollup": "4.0.25"
71
+ "@workflow/rollup": "4.0.27"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/ms": "2.1.0",