github emdash-cms/emdash @emdash-cms/sandbox-workerd@0.6.0

4 hours ago

Minor Changes

  • #2980 570333a Thanks @logelog! - Adds getVersioned, compareAndSet and compareAndDelete to plugin storage collections and ctx.kv. Native and sandboxed plugins can create an absent key or condition a replacement or deletion on the revision they read, preventing concurrent requests from silently overwriting each other.

    Pass an explicit null revision to create only when absent. A successful replacement returns its new revision; a conflict returns { applied: false }. Invalid input, permission failures and database failures reject the promise. Atomicity applies to one key, so changes spanning multiple records still require an application-level protocol.

    Update core and the sandbox adapter together and apply the host database migrations before using the methods. The migration initializes existing records without a backfill. Stored values are preserved, and existing unconditional writes continue to work while invalidating old revisions. Conditional keys are limited to 1,024 JavaScript string characters and values to 1 MiB of UTF-8 JSON.

Patch Changes

  • #3050 4c89130 Thanks @logelog! - Fixes plugin HTTP requests with allowedHosts so initial URLs and redirects also pass SSRF validation. Requests are rejected when URL or DNS validation identifies an unsupported scheme or a non-public address.

    Existing callers of the shared outbound URL validator also reject these non-public ranges.

    The default validator resolves public hostnames through cloudflare-dns.com before dispatch. Self-hosted deployments must permit access to that endpoint when using the default resolver.

  • #2169 107c3cc Thanks @vedanshujain! - Adds ctx.storage.<collection>.updateIf(id, { where, set?, delta? }) for atomic conditional updates to existing plugin documents. Use where to check stored fields, set to replace field values, and delta to increment or decrement integer counters. The method returns { applied: true, data } with the updated document, or { applied: false } when the document is absent or the condition fails. It never inserts a document.

    Malformed update arguments reject without writing. Deltas require safe integer operands and results; missing or null counters start at 0. Invalid stored counters, overflow, and non-object documents return { applied: false } without changing any fields.

    Available to native plugins and sandboxed plugins on Cloudflare and Workerd, with SQLite, D1, and PostgreSQL support. PostgreSQL serialization failures and deadlocks expose code: "STORAGE_SERIALIZATION_FAILURE" and retryable: true, including across sandbox transports. Retry standalone calls with bounded backoff, or restart the entire explicit transaction.

  • #3041 0ae2f26 Thanks @danielmlr! - Adds the cause to the SANDBOX_NOT_AVAILABLE error and to the "Plugin sandbox is configured but not available on this platform" startup warning when a configured sandbox runner cannot run plugins. On Cloudflare Workers the message names the missing worker_loaders binding or PluginBridge export; on Node.js it says that the workerd binary did not run.

    Sandbox runners report the cause through a new optional unavailableReason() method on SandboxRunner. Runners without it keep the previous messages.

  • #2967 c531f30 Thanks @danielmlr! - Fixes the workerd plugin sandbox logging Plugins will run unsandboxed after it stops restarting a repeatedly crashing workerd, when in fact every sandboxed hook and route fails from that point. The log line now names that consequence, and the reason on SandboxUnavailableError distinguishes a spent crash budget from a runner that never started.

  • Updated dependencies [36a021c, 573230f, 2b2f69e, 33cb7f0, befce6d, cd3e391, 3f516f4, b73a133, b1ccecd, fea6beb, 3bd30da, e13fa01, f9ac286, 0bcb1d9, 4c89130, 107c3cc, 107c3cc, 91a4aef, ef22a2d, f0af9a1, dd5ef1a, 0ae2f26, 27e432e, d409722, 8b3fd50, 1a71c9e, 91a4aef, 570333a]:

    • emdash@0.38.0

Don't miss a new emdash release

NewReleases is sending notifications on new releases.