Restricting what modules can be loaded into the runtime #40
Replies: 6 comments 5 replies
-
I'm going to be implementing this as outlined above as part of the plugins work. Would be great to get some feedback before I spend too much time on it. |
Beta Was this translation helpful? Give feedback.
-
I've been thinking about this. I'm not sure I can see the need for it. All modules are installed via npm - having a module on a denyList as a |
Beta Was this translation helpful? Give feedback.
-
Found another setting to deprecate - This will be replaced by
|
Beta Was this translation helpful? Give feedback.
-
As @HiroyasuNishiyama points out, we need to separate the enabling of installing new nodes from installing new modules. So instead of the single
The other properties remain the same and apply consistently across both nodes and modules. I don't see why having separate |
Beta Was this translation helpful? Give feedback.
-
Okay - I got this wrong. @HiroyasuNishiyama you were right to suggest having the settings scoped to the different purposes. I wanted to have a single set of properties that applied to all cases. But as I worked through it, I can see problems with that approach. In particular, it is the A reasonable scenario is a Node-RED administrator was to allow any node to be added to the palette, but to restrict the modules available to the Function node to a smaller list. With a single allows/deny list, it would be nearly impossible to achieve that... you'd need the So what do we think about the following:
|
Beta Was this translation helpful? Give feedback.
-
Have raised a PR against Node-RED core that implements the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on the Plugins design work and have identified a need to restrict what modules the runtime is allowed to load. This is similar to the
nodesExcludes
property, but works at a module name level.As I wrote out a design for it, I realised I was reproducing what is already proposed in the Function Lifecycle design from @HiroyasuNishiyama .
So I wanted to start a discussion (Hey - using the newly available Discussions feature on GitHub!) around how we can make this setting more generally used. I think we have a few different use cases for installing modules in Node-RED and want to make sure the settings we provide are logically consistent across them all.
Current settings
We currently provide the following settings related to installing new things in Node-RED:
editorTheme.palette.editable
- if set to false, the Admin API for installing/removing nodes is disabled and the editor hides the palette managernodesExcludes
- an array of individual filenames the runtime will refuse to loadautoInstallModules
- if set to true, the runtime will attempt to automatically reinstall node modules it had listed in its runtime settings (.config.nodes.json
), but didn't find on startup.Existing designs
We have three different designs in progress that relate to installing new modules.
We must make sure we have a consistent group of settings across all of these features.
Requirements
The main requirement is to provide the Node-RED Administrator (the person who edits the settings file) the ability to keep control over what a Node-RED User (the person using the editor) is able to install.
That should include:
Proposed settings
I propose we have a single setting block that covers installing modules in general (nodes, Function npm dependencies, plugins). Basically anything that involves running
npm install
.We will then deprecate the existing settings as follows:
editorTheme.palette.editable
forexternalModules.allowInstall
autoInstallModules
forexternalModules.allowInstall = true
andexternalModules.autoInstall = true
editorTheme.palette.upload
forexternalModules.allowUpload
The allow/deny lists will use simple globs rather than full regexes to keep it simple for the user.
For example:
If
allowList
is set, thendenyList
will default to["*"]
unless otherwise set.If
denyList
is set, thenallowList
will default to["*"]
unless otherwise set.The version specifier in the glob can use
<
,>
,<=
,>=
and~
in accordance with normal npm matching rules.The
allowList
/denyList
values will be passed to the editor so it can filter the list of modules it shows in the palette manager install tab.auto-update
not includedThis proposal does not include the
auto-update
feature proposed in the Function node lifecycle design. I do not think the runtime should ever silently upgrade modules. That should be something a user/administrator chooses to do.Beta Was this translation helpful? Give feedback.
All reactions