1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure credentials object is removed before returning node in getFlow request

Fixes #3953
This commit is contained in:
Nick O'Leary 2022-12-03 23:33:33 +00:00
parent 14e74afb07
commit c18018f017
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -641,6 +641,7 @@ function getFlow(id) {
if (node.type === 'link out') { if (node.type === 'link out') {
delete node.wires; delete node.wires;
} }
delete node.credentials;
return node; return node;
}) })
} }
@ -648,7 +649,10 @@ function getFlow(id) {
if (flow.configs) { if (flow.configs) {
var configIds = Object.keys(flow.configs); var configIds = Object.keys(flow.configs);
result.configs = configIds.map(function(configId) { result.configs = configIds.map(function(configId) {
return clone(flow.configs[configId]); const node = clone(flow.configs[configId]);
delete node.credentials;
return node
}) })
if (result.configs.length === 0) { if (result.configs.length === 0) {
delete result.configs; delete result.configs;
@ -660,12 +664,16 @@ function getFlow(id) {
var subflow = clone(flow.subflows[subflowId]); var subflow = clone(flow.subflows[subflowId]);
var nodeIds = Object.keys(subflow.nodes); var nodeIds = Object.keys(subflow.nodes);
subflow.nodes = nodeIds.map(function(id) { subflow.nodes = nodeIds.map(function(id) {
return subflow.nodes[id]; const node = clone(subflow.nodes[id])
delete node.credentials
return node
}); });
if (subflow.configs) { if (subflow.configs) {
var configIds = Object.keys(subflow.configs); var configIds = Object.keys(subflow.configs);
subflow.configs = configIds.map(function(id) { subflow.configs = configIds.map(function(id) {
return subflow.configs[id]; const node = clone(subflow.configs[id])
delete node.credentials
return node
}) })
} }
delete subflow.instances; delete subflow.instances;