Commit Graph
80 Commits
Author SHA1 Message Date
nocobase[bot] afe3409b03 Merge branch 'next' into develop 2026-04-21 01:57:55 +00:00
nocobase[bot] 9469ded2e5 Merge branch 'main' into next 2026-04-21 01:57:22 +00:00
Junyi 46fd9be1d3 Revert "fix(plugin-workflow-javascript): fix security issue (#9084)" (#9176)
This reverts commit f73f0d76cd.
2026-04-21 09:56:52 +08:00
Junyi 9c76d8bbad fix(plugin-workflow-javascript): fix error thrown from editor (#9169) 2026-04-20 21:34:40 +08:00
nocobase[bot] d8ac1e3339 chore(versions): 😊 publish v2.1.0-alpha.20 2026-04-20 10:33:38 +00:00
nocobase[bot] 80669c438d chore(versions): 😊 publish v2.1.0-beta.14 2026-04-20 09:04:05 +00:00
nocobase[bot] d87f4c0971 chore(versions): 😊 publish v2.0.40 2026-04-20 00:52:04 +00:00
nocobase[bot] 171cb7d51c chore(versions): 😊 publish v2.1.0-alpha.19 2026-04-19 04:03:09 +00:00
nocobase[bot] 0e810ddcb2 Merge branch 'next' into develop 2026-04-18 11:57:00 +00:00
nocobase[bot] b30ec62ff7 Merge branch 'main' into next 2026-04-18 11:56:29 +00:00
JunyiandClaude Sonnet 4.6 f73f0d76cd fix(plugin-workflow-javascript): fix security issue (#9084)
* fix(plugin-workflow-javascript): fix security issue

* fix(plugin-workflow-javascript): fix path assertion under windows in test case

* fix(plugin-workflow-javascript): sanitize module function return values to close return-value bypass

Extend the sandbox hardening to also sanitize objects returned by wrapped
module functions (including Promise resolutions), so that prototype-chain
traversal via return values (e.g. crypto.createHash().update.constructor)
cannot reach the host Function constructor.

- Add sanitizeReturnValue() that sanitizes sync return values and
  thenable resolutions before they re-enter the sandbox
- Wire sanitizeReturnValue() into the function wrapper inside
  sanitizeForSandbox() so every module function call goes through it
- Walk the prototype chain up to MAX_PROTO_DEPTH=3 in the object branch
  so methods defined on the object's own prototype (e.g.
  Hash.prototype.update, Stats.prototype.isFile) are also exposed as
  hardened null-proto wrappers rather than raw host-realm functions
- Add resolveProperty() helper that reads accessor-descriptor properties
  (getters) by invoking desc.get — required for lazy-getter module
  exports such as mathjs.evaluate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(plugin-workflow-javascript): sanitize exceptions and Promises from module calls

Address two P1 bypasses reported in PR review:

P1.1 — Module function exceptions: the function wrapper now wraps fn(...args)
in try/catch and calls sanitizeError() before re-throwing, so a host-realm
Error caught inside the sandbox (e.g. from path.join(null)) no longer exposes
e.constructor.constructor → host Function.

P1.2 — Host Promise exposed to sandbox: sanitizeReturnValue() no longer returns
the raw host Promise (whose .constructor chain reaches host Function). It now
builds a null-prototype clean thenable that intercepts onFulfilled/onRejected
callbacks, sanitizing resolved values via sanitizeForSandbox() and errors via
sanitizeError() before they reach sandbox code.

Also adds sanitizeError() helper shared by both fixes, and extends the test
suite with:
- P1.1 security test: path.join(null) throw chain is blocked
- P1.2 security test: fs.promises.readdir Promise constructor chain is blocked
- Functional regression: fs.promises.readdir still returns usable data after
  sanitization (note: result is a null-proto object; Array.isArray returns false
  but indexed access and .length work — raw Arrays cannot be returned safely as
  their __proto__.constructor chain leads back to host Function)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(plugin-workflow-javascript): restore array iteration for sanitized module return values

Arrays returned by module functions were converted to null-prototype plain
objects, which broke for...of, spread ([...arr]), and destructuring — the
three most common ways to consume arrays in modern JavaScript.

Add a special-case Array branch in sanitizeForSandbox() that:
- copies indexed elements and length to a null-proto object (preserving
  security: no Array.prototype.constructor chain exposure)
- attaches a safe Symbol.iterator backed by a null-proto iterator whose
  .next() results are also null-proto objects — no host-realm chain at any
  level, so the iterator cannot be used to reach the host Function constructor

After this change:
  const entries = await fs.promises.readdir('.')
  for (const e of entries) { ... }   // works
  const arr = [...entries]           // works; arr is a real sandbox Array
  const [first] = entries            // works
  entries.length / entries[0]        // works (unchanged)
  Array.isArray(entries)             // still false (by design, host Array is unsafe)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(plugin-workflow-javascript): json round-trip script return value before postMessage

The script node result is always stored in the database as JSON and re-parsed
by subsequent workflow nodes, so JavaScript-specific semantics (null prototypes,
Symbols, functions) carry no meaning at the postMessage boundary.

Add toJsonResult() that applies JSON.parse(JSON.stringify(value)) to the final
script return value before postMessage, ensuring:
- null-prototype objects produced by sanitizeForSandbox are converted to proper
  plain objects / Arrays (Array.isArray works correctly in downstream nodes)
- function-valued properties are silently dropped (expected for serialized data)
- the result is always structured-clone compatible

Note: sanitizeForSandbox + Symbol.iterator are still required for values used
within the script during execution (e.g. iterating a module-returned array
before returning the result). toJsonResult() only normalises the boundary value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(plugin-workflow-javascript): fix security issues

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:55:54 +08:00
nocobase[bot] b03cab07e7 chore(versions): 😊 publish v2.0.39 2026-04-17 22:30:52 +00:00
nocobase[bot] 4ee6379274 chore(versions): 😊 publish v2.1.0-alpha.18 2026-04-17 05:03:11 +00:00
nocobase[bot] 9359d31a88 chore(versions): 😊 publish v2.1.0-alpha.17 2026-04-17 02:32:55 +00:00
nocobase[bot] edbfef7fc9 chore(versions): 😊 publish v2.0.38 2026-04-16 12:11:58 +00:00
nocobase[bot] 94fb7f4f13 chore(versions): 😊 publish v2.0.37 2026-04-14 02:29:40 +00:00
nocobase[bot] 9dde9991fe chore(versions): 😊 publish v2.1.0-alpha.16 2026-04-13 23:54:06 +00:00
nocobase[bot] e2b676a3d0 chore(versions): 😊 publish v2.1.0-alpha.15 2026-04-10 12:28:12 +00:00
nocobase[bot] 0fc38a5f50 chore(versions): 😊 publish v2.0.36 2026-04-10 10:38:51 +00:00
nocobase[bot] cd68304234 chore(versions): 😊 publish v2.0.35 2026-04-09 14:44:46 +00:00
nocobase[bot] fceb02e6d0 chore(versions): 😊 publish v2.0.34 2026-04-08 23:19:31 +00:00
nocobase[bot] 32f88f129b chore(versions): 😊 publish v2.1.0-beta.13 2026-04-08 16:06:08 +00:00
nocobase[bot] 9ba1c8dc0d chore(versions): 😊 publish v2.0.33 2026-04-08 13:23:07 +00:00
nocobase[bot] b6e8f0f3d0 chore(versions): 😊 publish v2.1.0-beta.12 2026-04-08 08:01:25 +00:00
nocobase[bot] 1f3e950d04 chore(versions): 😊 publish v2.1.0-alpha.14 2026-04-07 15:43:29 +00:00
nocobase[bot] df67d56a8c chore(versions): 😊 publish v2.0.32 2026-04-04 04:57:54 +00:00
nocobase[bot] aabeeb955e chore(versions): 😊 publish v2.0.31 2026-04-01 12:46:39 +00:00
mytharcher 2653c9332f Merge branch 'next' into develop 2026-03-31 22:00:42 +08:00
nocobase[bot] 29994a5b95 chore(versions): 😊 publish v2.0.30 2026-03-30 14:55:14 +00:00
nocobase[bot] 0ac8745a14 Merge branch 'main' into next 2026-03-30 14:02:08 +00:00
Junyi d7c5a6868d refactor(plugin-workflow-javascript): change default engine to isolated-vm (#8973)
* refactor(plugin-workflow-javascript): change default engine to isolated-vm

* refactor(plugin-workflow-javascript): simplify env

* docs(plugin-workflow-javascript): add docs due to engine refactored
2026-03-30 22:01:36 +08:00
nocobase[bot] 11ad4393cb chore(versions): 😊 publish v2.0.29 2026-03-29 16:14:12 +00:00
nocobase[bot] 26eefed9f8 chore(versions): 😊 publish v2.0.28 2026-03-27 15:38:29 +00:00
nocobase[bot] d9e5a9bbe2 chore(versions): 😊 publish v2.1.0-alpha.13 2026-03-27 05:36:58 +00:00
Junyi d9aafbb1b7 feat(plugin-workflow): add validation (#8971)
* feat(plugin-workflow): add validation

* feat(plugin-workflow): add validation rules
2026-03-27 09:01:55 +08:00
nocobase[bot] 0bb8dc6d12 Merge branch 'next' into develop 2026-03-26 12:59:22 +00:00
nocobase[bot] cdb45fcbe5 Merge branch 'main' into next 2026-03-26 12:58:51 +00:00
Junyi 24203d7a01 fix(plugin-workflow-javascript): fix security issue (#8967) 2026-03-26 20:58:15 +08:00
nocobase[bot] 31c0899dc0 chore(versions): 😊 publish v2.0.27 2026-03-26 10:42:51 +00:00
nocobase[bot] ed428e589d chore(versions): 😊 publish v2.1.0-alpha.12 2026-03-25 13:50:52 +00:00
nocobase[bot] ef1b2c1273 chore(versions): 😊 publish v2.0.26 2026-03-25 11:08:17 +00:00
nocobase[bot] 6a755e319c chore(versions): 😊 publish v2.1.0-alpha.11 2026-03-25 08:35:49 +00:00
nocobase[bot] a5b292f635 chore(versions): 😊 publish v2.0.25 2026-03-23 17:50:40 +00:00
nocobase[bot] 1357c21192 chore(versions): 😊 publish v2.0.24 2026-03-22 08:38:06 +00:00
nocobase[bot] 9c5afc3c07 chore(versions): 😊 publish v2.0.23 2026-03-20 16:10:56 +00:00
nocobase[bot] 7f6916f570 chore(versions): 😊 publish v2.1.0-alpha.10 2026-03-20 08:49:53 +00:00
nocobase[bot] fff8ec35c8 chore(versions): 😊 publish v2.1.0-beta.11 2026-03-20 07:52:25 +00:00
nocobase[bot] b6e69d3cf1 chore(versions): 😊 publish v2.0.22 2026-03-20 04:34:01 +00:00
nocobase[bot] d1708d51f9 chore(versions): 😊 publish v2.0.21 2026-03-20 01:27:20 +00:00
nocobase[bot] 4aa6420806 chore(versions): 😊 publish v2.0.20 2026-03-19 05:01:16 +00:00