Commit Graph
65 Commits
Author SHA1 Message Date
nocobase[bot] 500004c138 chore(versions): 😊 publish v2.0.60 2026-05-29 10:01:37 +00:00
nocobase[bot] 461583d528 chore(versions): 😊 publish v2.0.59 2026-05-28 11:41:07 +00:00
nocobase[bot] 93a3ef729f chore(versions): 😊 publish v2.0.58 2026-05-28 02:19:43 +00:00
nocobase[bot] e35a2737d9 chore(versions): 😊 publish v2.0.57 2026-05-25 21:44:59 +00:00
nocobase[bot] d47457b5bc chore(versions): 😊 publish v2.0.56 2026-05-21 17:15:40 +00:00
nocobase[bot] 67109a8bac chore(versions): 😊 publish v2.0.55 2026-05-18 07:12:55 +00:00
nocobase[bot] 467388edee chore(versions): 😊 publish v2.0.54 2026-05-15 07:50:17 +00:00
nocobase[bot] 34150958b6 chore(versions): 😊 publish v2.0.53 2026-05-14 09:38:35 +00:00
nocobase[bot] 5a899306ed chore(versions): 😊 publish v2.0.52 2026-05-13 14:56:47 +00:00
nocobase[bot] 7bfc752826 chore(versions): 😊 publish v2.0.51 2026-05-10 06:44:44 +00:00
nocobase[bot] 3c5400b991 chore(versions): 😊 publish v2.0.50 2026-05-09 04:49:35 +00:00
nocobase[bot] 10bb3abeb5 chore(versions): 😊 publish v2.0.49 2026-05-06 04:34:32 +00:00
nocobase[bot] b9fced6441 chore(versions): 😊 publish v2.0.48 2026-05-04 04:28:19 +00:00
nocobase[bot] 4be71211c4 chore(versions): 😊 publish v2.0.47 2026-05-01 15:15:58 +00:00
mytharcher 23270f3c16 fix(plugin-workflow-javascript): use mock url for axios test 2026-04-29 21:14:02 +08:00
nocobase[bot] c2dbc61222 chore(versions): 😊 publish v2.0.46 2026-04-28 23:09:32 +00:00
nocobase[bot] f2b483c63f chore(versions): 😊 publish v2.0.45 2026-04-27 14:18:56 +00:00
PiEgg a601f85596 chore: update Node.js runtime to 22 (#9245) 2026-04-26 16:53:31 +08:00
nocobase[bot] d11a1aae12 chore(versions): 😊 publish v2.0.44 2026-04-26 03:23:16 +00:00
nocobase[bot] 032ac4aab8 chore(versions): 😊 publish v2.0.43 2026-04-24 06:06:55 +00:00
nocobase[bot] 7fbb1e6374 chore(versions): 😊 publish v2.0.42 2026-04-23 15:46:17 +00:00
nocobase[bot] cfef6309b4 chore(versions): 😊 publish v2.0.41 2026-04-22 07:15:50 +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
nocobase[bot] d87f4c0971 chore(versions): 😊 publish v2.0.40 2026-04-20 00:52:04 +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] 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] 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] 9ba1c8dc0d chore(versions): 😊 publish v2.0.33 2026-04-08 13:23:07 +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
nocobase[bot] 29994a5b95 chore(versions): 😊 publish v2.0.30 2026-03-30 14:55:14 +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
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] ef1b2c1273 chore(versions): 😊 publish v2.0.26 2026-03-25 11:08:17 +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] 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
nocobase[bot] ce1d969721 chore(versions): 😊 publish v2.0.19 2026-03-17 17:00:58 +00:00
nocobase[bot] c7e44c4e6c chore(versions): 😊 publish v2.0.18 2026-03-17 02:53:12 +00:00
nocobase[bot] dba970c84a chore(versions): 😊 publish v2.0.17 2026-03-14 03:10:06 +00:00