Commit Graph

14 Commits

Author SHA1 Message Date
Mutasem Aldmour
ff8bc0aa7b
fix(core): Stop the Python import guidance pointing at deployment config
Some checks failed
CI: Python / Checks (push) Has been cancelled
On managed deployments the import allowlist is not the user's to change, so an
agent that names `N8N_RUNNERS_STDLIB_ALLOW` or tells them their setting is
invalid only produces a support request about something nobody will change for
them. Cloud also runs task runners in external mode, where n8n cannot see the
runner's configuration at all, so that guidance was doubly unfounded there.

Every agent- and user-facing surface now states the capability and stops: assume
no imports, write import-free Python, or use JavaScript. Environment variables
survive only in code comments and the config class, where operators read them.

The external-mode and rejected-allowlist cases now share one message. They led to
the same action already, and the separate wording existed only to name the
setting behind each.

Tests pin the rule across every policy shape rather than the phrasing, so a
future edit cannot quietly reintroduce a config recommendation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 15:47:56 +02:00
Mutasem Aldmour
02169bafdc
feat(core): Tell the workflow builder this instance's Python import policy
The native Python runner's import allowlists are per-deployment and empty by
default, so a fixed "no imports" rule is wrong on an instance that configured
one and a fixed "imports work" rule is wrong everywhere else. Every surface now
reads the configuration and says what is actually true here.

- Add `stdlibAllow` / `externalAllow` to `TaskRunnersConfig`, and spawn the
  Python runner from those instead of `process.env`, so the value n8n reports is
  the one the runner enforces.
- Derive `pythonImportPolicy` on `InstanceAiContext`. It is authoritative only in
  internal runner mode; in external mode the runner is configured separately, so
  the policy is marked a guess and the messaging says so.
- `lintPythonCode` takes the policy and only flags imports the runner will
  actually reject, naming what is allowed. Without a policy nothing is assumed
  allowed, which keeps the sandbox CLI conservative.
- Add a system-prompt section stating the effective policy, and a
  `detect-python-code-constraints` host check that re-runs the rules at
  build-workflow time with the real allowlist. Informational; it does not block.
- Reword the static surfaces — Code node hints and the workflow-builder skill —
  so they describe imports as opt-in per deployment and defer to those two.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 10:20:20 +02:00
Mutasem Aldmour
ba0f19abb3
fix(core): Address review feedback on Python Code node lint
- Thread the node execution mode into `lintPythonCode` and flag reading the
  accessor the runner only defines in the other mode, mirroring the JS rule's
  `CODE_MODE_API_MISUSE`.
- Detect relative imports; the runner rejects them with "Relative imports are
  disallowed" and the previous root extraction produced no module for them.
- Make the import message module-neutral. It now names both allowlists rather
  than reporting the standard-library error for an external package.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 10:34:52 +02:00
Mutasem Aldmour
29d29ac753
fix(core): Stop the workflow builder writing Python Code nodes that cannot run
The native Python runner allows no imports unless the deployment sets
N8N_RUNNERS_STDLIB_ALLOW, which is empty by default and forced empty in the
official runners image. It also defines only `_items`, `_item` and `print`.
The builder had no way to know either constraint: the `pythonCode` builderHint
covered only network access, and the property description still advertised
`_today` and `_jmespath`, which went away with Pyodide.

- Correct the `pythonCode` description and builderHint, and add a `language`
  builderHint that steers to JavaScript unless Python was asked for.
- Add `CODE_NODE_PYTHON_IMPORT` and `CODE_NODE_PYTHON_UNSUPPORTED_GLOBAL` to
  the Code node Python linter, so `workflow-sdk validate` reports both defects.
- Note the constraints in the workflow-builder skill.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 10:09:44 +02:00
Albert Alises
9d8fca8746
fix(core): Prevent workflow builder from making HTTP requests in Code nodes (no-changelog) (#32084) 2026-06-11 12:08:06 +00:00
Iván Ovejero
f72fdc0b14
fix(core): Route both Python options to the native Python runner (#24511) 2026-01-19 09:23:36 +00:00
Iván Ovejero
ea889bee89
refactor(core, editor): Remove Pyodide (#23572) 2025-12-29 14:54:15 +01:00
Iván Ovejero
fabbddefdc
refactor(editor): Update Code node editor for native Python runner (#18538) 2025-08-19 13:40:02 +02:00
Iván Ovejero
47cb4a07ca
refactor(core): Include native Python option in Code node (#18331) 2025-08-18 12:25:47 +02:00
Elias Meire
071e6d6b6e
feat(editor): Add fullscreen view to code editor (#8084)
## Summary

<img width="1240" alt="image"
src="https://github.com/n8n-io/n8n/assets/8850410/2819f4ce-c343-431a-8a88-a1bc9c4b572a">
<img width="2649" alt="image"
src="https://github.com/n8n-io/n8n/assets/8850410/36862aaf-cc4c-4668-bdc8-cf5a6f00babe">

1. Add code node and open it
3. Click the fullscreen button in the bottom right
4. A fullscreen dialog should appear and allow editing the code
5. Changes made in the fullscreen dialog should be applied to the
original code editor when closed

It should work the same way for HTML/SQL/JSON editors

⚠️ Modal layout was updated so that modals/dialogs are centered, try to
test some modals

## Related tickets and issues
https://linear.app/n8n/issue/NODE-1009/add-fullscreen-view-to-code-node



## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
   > A feature is not complete without tests.

---------

Co-authored-by: Giulio Andreini <andreini@netseven.it>
2024-01-04 17:23:24 +01:00
Deborah
485a0c73cb
docs: Fix typo in tooltip relating to JMESPath (#7910) 2023-12-04 08:19:36 +00:00
Michael Kret
3a474552b2
feat(Set Node): Overhaul (#6348)
Github issue / Community forum post (link here to close automatically):
https://github.com/n8n-io/n8n/pull/6348

---------

Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
Co-authored-by: Marcus <marcus@n8n.io>
2023-09-19 13:16:35 +03:00
कारतोफ्फेलस्क्रिप्ट™
bf351243df
fix(Code Node): Install python modules always in a user-writable folder (#6568)
* upgrade pyodide

* install pyodide modules to a custom user-writable path

* in `augmentObject` `newData` is never undefined
2023-07-07 16:43:45 +02:00
Jan Oberhauser
35c8510ab6
feat(Code Node): Add Python support (#4295) 2023-05-04 20:00:00 +02:00