mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add exportGlobalContextKeys to prevent exposing fgc keys
This commit is contained in:
parent
9e74ddac48
commit
4463a8e3b2
@ -392,7 +392,7 @@ function createContext(id,seed,parent) {
|
|||||||
}
|
}
|
||||||
context = getContextStorage(storage);
|
context = getContextStorage(storage);
|
||||||
}
|
}
|
||||||
if (seed) {
|
if (seed && settings.exportGlobalContextKeys !== false) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
context.keys(scope, function(err,keys) {
|
context.keys(scope, function(err,keys) {
|
||||||
callback(err,Array.from(new Set(seedKeys.concat(keys)).keys()));
|
callback(err,Array.from(new Set(seedKeys.concat(keys)).keys()));
|
||||||
|
19
packages/node_modules/node-red/settings.js
vendored
19
packages/node_modules/node-red/settings.js
vendored
@ -205,18 +205,27 @@ module.exports = {
|
|||||||
// // - reason: if result is false, the HTTP reason string to return
|
// // - reason: if result is false, the HTTP reason string to return
|
||||||
//},
|
//},
|
||||||
|
|
||||||
// Anything in this hash is globally available to all functions.
|
// The following property can be used to seed Global Context with predefined
|
||||||
// It is accessed as context.global.
|
// values. This allows extra node modules to be made available with the
|
||||||
// eg:
|
// Function node.
|
||||||
|
// For example,
|
||||||
// functionGlobalContext: { os:require('os') }
|
// functionGlobalContext: { os:require('os') }
|
||||||
// can be accessed in a function block as:
|
// can be accessed in a function block as:
|
||||||
// context.global.os
|
// global.get("os")
|
||||||
|
|
||||||
functionGlobalContext: {
|
functionGlobalContext: {
|
||||||
// os:require('os'),
|
// os:require('os'),
|
||||||
// jfive:require("johnny-five"),
|
// jfive:require("johnny-five"),
|
||||||
// j5board:require("johnny-five").Board({repl:false})
|
// j5board:require("johnny-five").Board({repl:false})
|
||||||
},
|
},
|
||||||
|
// `global.keys()` returns a list of all properties set in global context.
|
||||||
|
// This allows them to be displayed in the Context Sidebar within the editor.
|
||||||
|
// In some circumstances it is not desirable to expose them to the editor. The
|
||||||
|
// following property can be used to hide any property set in `functionGlobalContext`
|
||||||
|
// from being list by `global.keys()`.
|
||||||
|
// By default, the property is set to false to avoid accidental exposure of
|
||||||
|
// their values. Setting this to true will cause the keys to be listed.
|
||||||
|
exportGlobalContextKeys: false,
|
||||||
|
|
||||||
|
|
||||||
// Context Storage
|
// Context Storage
|
||||||
// The following property can be used to enable context storage. The configuration
|
// The following property can be used to enable context storage. The configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user