mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add validation of library plugin id and better error reporting
This commit is contained in:
parent
c2347076f4
commit
6f9e06e78d
@ -38,6 +38,11 @@ function init(runtime) {
|
|||||||
runtimeLibraries.forEach(library => {
|
runtimeLibraries.forEach(library => {
|
||||||
if (library.type === id) {
|
if (library.type === id) {
|
||||||
library.local = false;
|
library.local = false;
|
||||||
|
|
||||||
|
if (!/^[a-z0-9-_]+$/.test(library.id)) {
|
||||||
|
log.warn(log._("library.failedToInit",{error:log._("library.invalidProperty",{prop:"id",value:library.id})}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
libraries[library.id] = new plugin.class(library)
|
libraries[library.id] = new plugin.class(library)
|
||||||
libraryConfigs[library.id] = library;
|
libraryConfigs[library.id] = library;
|
||||||
|
@ -93,7 +93,8 @@
|
|||||||
"unknownLibrary": "Unknown library: __library__",
|
"unknownLibrary": "Unknown library: __library__",
|
||||||
"unknownType": "Unknown library type: __type__",
|
"unknownType": "Unknown library type: __type__",
|
||||||
"readOnly": "Library __library__ is read-only",
|
"readOnly": "Library __library__ is read-only",
|
||||||
"failedToInit": "Failed to initialise __library__: __error__"
|
"failedToInit": "Failed to initialise library __library__: __error__",
|
||||||
|
"invalidProperty": "Invalid property __prop__: '__value__'"
|
||||||
},
|
},
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"credentials": {
|
"credentials": {
|
||||||
|
Loading…
Reference in New Issue
Block a user