Skip to content

阻止对节点的访问(Block access to nodes)#

出于安全原因,你可能希望阻止用户访问或使用特定的 n8n 节点。如果你的用户可能不可靠,这会非常有用。

🌐 For security reasons, you may want to block your users from accessing or working with specific n8n nodes. This is helpful if your users might be untrustworthy.

使用 NODES_EXCLUDE 环境变量来阻止用户访问特定节点。

🌐 Use the NODES_EXCLUDE environment variable to prevent your users from accessing specific nodes.

排除节点(Exclude nodes)#

更新你的 NODES_EXCLUDE 环境变量,将包含任意节点的字符串数组添加进去,这些节点是你不希望用户使用的。

🌐 Update your NODES_EXCLUDE environment variable to include an array of strings containing any nodes you want to block your users from using.

例如,按如下方式设置变量:

🌐 For example, setting the variable this way:

1
NODES_EXCLUDE: "[\"n8n-nodes-base.executeCommand\", \"n8n-nodes-base.readWriteFile\"]"

阻止 执行命令从磁盘读取/写入文件 节点。

🌐 Blocks the Execute Command and Read/Write Files from Disk nodes.

你的 n8n 用户将无法搜索或使用这些节点。

🌐 Your n8n users won't be able to search for or use these nodes.

建议屏蔽的节点(Suggested nodes to block)#

可能带来安全风险的节点取决于你的使用场景和用户类型。以下是你可能想要从这些节点开始的几个示例:

🌐 The nodes that can pose security risks vary based on your use case and user profile. Here are some nodes you might want to start with:

启用默认被阻止的节点(Enable nodes that are blocked by default)#

某些节点,例如执行命令,默认是被禁用的。将它们从排除列表中移除以启用它们:

🌐 Some nodes, like Execute Command, are blocked by default. Remove them from the exclude list to enable them:

1
NODES_EXCLUDE: "[]"

有关此环境变量的更多信息,请参阅 Nodes 环境变量

🌐 Refer to Nodes environment variables for more information on this environment variable.

有关设置环境变量的更多信息,请参阅配置

🌐 Refer to Configuration for more information on setting environment variables.