1
0
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:
Nick O'Leary 2021-02-19 14:39:42 +00:00
parent c2347076f4
commit 6f9e06e78d
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,11 @@ function init(runtime) {
runtimeLibraries.forEach(library => {
if (library.type === id) {
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 {
libraries[library.id] = new plugin.class(library)
libraryConfigs[library.id] = library;

View File

@ -93,7 +93,8 @@
"unknownLibrary": "Unknown library: __library__",
"unknownType": "Unknown library type: __type__",
"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": {
"credentials": {