Commit Graph

40 Commits

Author SHA1 Message Date
Mutasem Aldmour
09632b6711
fix(core): Address review feedback on the Python import policy
- Only treat imports as unrestricted when BOTH allowlists are wildcards, which is
  the condition the runner's own analyzer short-circuits on. With one wildcard the
  runner still checks the other category, and classifying a module needs Python's
  stdlib list, so the linter now abstains explicitly instead of implying the
  import is fine.
- Render the two allowlists as separate categories in the prompt and the lint
  message. Merging them presented a module filed under the wrong one as
  importable, though the runner rejects it.
- Stop claiming "this deployment allowlists nothing" when no policy was supplied.
  The sandbox CLI cannot see the configuration, and now says so.
- Report a wildcard combined with named modules as a misconfiguration rather than
  as a permissive allowlist. The runner refuses to start on it, so the previous
  reading told the builder its imports were fine when no Python could run at all.
- Only trust the policy in the build-time check when it is authoritative. In
  external runner mode the runner may be stricter than n8n thinks, so a
  non-authoritative policy must not silence a warning.
- Skip a stale `pythonCode` body on a node whose language is JavaScript.
- Replace a `toContain('re')` assertion that also matched "runner" in the
  surrounding prompt text, and correct the fixture's path to its Python checker.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 11:56:28 +02:00
Mutasem Aldmour
8f758f48ef
test(core): Cover the Python import allowlist across the n8n/runner seam
n8n now parses the same allowlist the Python runner enforces, so the two can
drift: the runner's suite and n8n's unit tests could both stay green while the
builder describes a policy that is not applied.

- Add a shared fixture, read by a test on each side, pinning how
  N8N_RUNNERS_STDLIB_ALLOW / N8N_RUNNERS_EXTERNAL_ALLOW parse. It caught a real
  divergence on the first run: the runner returns a set and collapses
  duplicates, n8n's parser did not. Fixed.
- Add an integration test that starts the Python runner for real and drives a
  Code node through the broker, covering config -> spawned runner env ->
  enforcement in one path: import-free code runs, an allowlisted import runs, a
  non-allowlisted one is rejected, and the rejection names the configured list
  (so it cannot pass against an empty default).

The integration test needs the runner's virtualenv and skips without it, which
is most Node CI lanes today; verified it skips rather than fails. Making
`getVenvPath` public is what lets it decide that synchronously.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 11:42:14 +02:00
Lorent Lempereur
b6bb202b7b
refactor: Assign task runner IDs from n8n (#35494) 2026-08-10 11:20:37 +00:00
Emilia
95a81ed219
feat(core): Add N8N_RUNNERS_ALLOW_TRANSITIVE_IMPORTS for the Python task runner (#33130)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 08:20:12 +00:00
Emilia
46aa8e4af7
fix(core): Let allowlisted Python packages import their own submodules via relative imports (#32772)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 08:32:02 +00:00
n8n-assistant[bot]
71262655e4
chore: Bundle/2.x (#32031)
Co-authored-by: Matsu <matias.huhta@n8n.io>
Co-authored-by: Dawid Myslak <dawid.myslak@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Arvin A <51036481+DeveloperTheExplorer@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Dimitri Lavrenük <20122620+dlavrenuek@users.noreply.github.com>
Co-authored-by: Garrit Franke <32395585+garritfra@users.noreply.github.com>
Co-authored-by: Jaakko Husso <jaakko@n8n.io>
Co-authored-by: Daria <daria.staferova@n8n.io>
Co-authored-by: Oğuz Eroğlu <oguz.eroglu@n8n.io>
Co-authored-by: Robin Braumann <robin.braumann@n8n.io>
Co-authored-by: oleg <me@olegivaniv.com>
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
Co-authored-by: José Braulio González Valido <jose.gonzalez@n8n.io>
Co-authored-by: Alexander Gekov <40495748+alexander-gekov@users.noreply.github.com>
Co-authored-by: Bernhard Wittmann <bernhard.wittmann@n8n.io>
2026-06-10 07:42:43 +00:00
n8n-assistant[bot]
d4f9223842
chore: Bundle/2.x (#31173)
Co-authored-by: Matsu <matias.huhta@n8n.io>
Co-authored-by: Elias Meire <elias@meire.dev>
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Dawid Myslak <dawid.myslak@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 08:36:28 +03:00
Iván Ovejero
a7864762ca
fix: Restore broken stdlib calls in Python Code node (#29776) 2026-05-05 11:53:14 +00:00
n8n-assistant[bot]
85b7796434
chore: Bundle 2.x (#28844)
Co-authored-by: Matsu <matias.huhta@n8n.io>
Co-authored-by: Dawid Myslak <dawid.myslak@gmail.com>
Co-authored-by: Bernhard Wittmann <bernhard.wittmann@n8n.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Dimitri Lavrenük <20122620+dlavrenuek@users.noreply.github.com>
Co-authored-by: Benjamin Schroth <68321970+schrothbn@users.noreply.github.com>
Co-authored-by: Danny Martini <danny@n8n.io>
Co-authored-by: RomanDavydchuk <roman.davydchuk@n8n.io>
Co-authored-by: Sandra Zollner <sandra.zollner@n8n.io>
Co-authored-by: Milorad FIlipović <milorad@n8n.io>
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2026-04-22 08:51:32 +03:00
n8n-assistant[bot]
562d867483
chore: Bundle 2026-W7 (#26214)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
Co-authored-by: yehorkardash <yehor.kardash@n8n.io>
Co-authored-by: James Gee <1285296+geemanjs@users.noreply.github.com>
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Stephen Wright <sjw948@gmail.com>
Co-authored-by: oleg <me@olegivaniv.com>
Co-authored-by: Albert Alises <albert.alises@gmail.com>
Co-authored-by: Danny Martini <danny@n8n.io>
2026-02-25 07:08:58 +00:00
Iván Ovejero
483c8210ee
feat(core): Add drain timeout for runners (#24290) 2026-02-06 13:34:53 +00:00
Tomi Turtiainen
659de949cb
feat(core): Add profiling support via sentry (#25049) 2026-01-30 09:49:50 +00:00
Iván Ovejero
8693d9ead1
refactor(core): Improve Python match extraction handling (#24975) 2026-01-28 10:37:33 +00:00
Iván Ovejero
76b4604a31
refactor(core): Improve f-string handling (#24864) 2026-01-27 08:52:35 +00:00
Iván Ovejero
63c2f82741
refactor(core): Normalize exception attribute access in Python task runner (#24216) 2026-01-13 14:22:33 +00:00
Iván Ovejero
93bb0c5399
fix(core): Ensure runner does not terminate pipe reader prematurely (#23448) 2025-12-19 17:16:17 +01:00
Iván Ovejero
9a56529d5d
fix(core): Protect against name-mangling in native Python runner (#21482) 2025-11-03 13:16:47 +01:00
Iván Ovejero
fbd60d2a07
fix(core): Ensure reconnect on broker down in native Python runner (#21475) 2025-11-03 14:11:39 +02:00
Iván Ovejero
98baeec45e
refactor(core): Minor leftover cleanups in native Python runner (#21473) 2025-11-03 13:04:54 +01:00
Iván Ovejero
614f89b8a0
refactor(core): Switch to multiprocessing pipes in native Python runner (#21232) 2025-10-30 12:29:59 +01:00
Iván Ovejero
7cea1e26fe
fix(core): Harden security restrictions in native Python runner (#21263) 2025-10-28 11:47:47 +01:00
Iván Ovejero
8527e4b6f1
feat(core): Support N8N_BLOCK_RUNNER_ENV_ACCESS in native Python runner (#21215) 2025-10-27 12:15:54 +01:00
Iván Ovejero
4de20da3da
refactor(core): Strengthen Python security validator (#21086) 2025-10-23 13:40:13 +02:00
Iván Ovejero
8b74461bc8
ci: Fix formatting check in Python CI (#20860) 2025-10-16 13:13:18 +02:00
Iván Ovejero
37aa81d6cd
test(core): Dynamically allocate ports for Python integration tests (#20825) 2025-10-16 10:39:12 +02:00
Iván Ovejero
2224647fa6
fix(core): Fix normalization in per-item mode in native Python runner (#20750) 2025-10-14 14:23:21 +02:00
Iván Ovejero
6bb660b52e
refactor(core): Improve observability for task failures in native Python runner (#20754) 2025-10-14 12:28:27 +02:00
Iván Ovejero
0026b6b6b0
fix(core): Prevent subscript access to blocked attributes (#20710) 2025-10-13 13:20:23 +02:00
Iván Ovejero
7ae88f836c
fix(core): Block introspection attributes unconditionally (#20641) 2025-10-10 13:59:34 +02:00
Iván Ovejero
09c8559c2c
fix: Prevent runtime import via __builtins__ dict in native Python runner (#20628) 2025-10-10 12:39:30 +02:00
Iván Ovejero
bcdbada74b
fix(core): Tighten Sentry error filtering in native Python runner (#20500) 2025-10-08 09:26:58 +02:00
Iván Ovejero
123a742685
fix(core): Remove logs skipping flag from native Python runner (#20441) 2025-10-07 09:20:04 +02:00
Iván Ovejero
7eb8a32450
fix(core): Keep submodules of safe modules in native Python runner (#20284) 2025-10-02 09:54:24 +02:00
Iván Ovejero
77d7408093
fix(core): Add globals and locals to denylist in native Python runner (#20172) 2025-09-30 09:00:28 +02:00
Iván Ovejero
5a3adf5c97
feat(core): Support _FILE in native Python runner (no-changelog) (#20035) 2025-09-26 12:03:36 +02:00
Iván Ovejero
72a94c5e41
fix(core): Do not report SyntaxError to Sentry in native Python runner (no-changelog) (#20031) 2025-09-25 17:11:34 +02:00
Iván Ovejero
b5e685b6f2
fix(core): Do not report security violations to Sentry in native Python runner (no-changelog) (#19867) 2025-09-22 16:50:49 +02:00
Iván Ovejero
41aa8b4ec6
refactor: Switch multiprocessing context to fork in native Python runner (#19402) 2025-09-11 14:49:40 +02:00
Iván Ovejero
36958e3ffa
test: Add integration tests for execution flows in native Python runner (#19198) 2025-09-05 10:49:45 +02:00
Iván Ovejero
fc094518d6
test(core): Test security validation in native Python runner (#19146) 2025-09-03 16:19:01 +02:00