1
0
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:
Nick O'Leary 2019-03-04 16:10:39 +00:00
parent 9e74ddac48
commit 4463a8e3b2
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 15 additions and 6 deletions

View File

@ -392,7 +392,7 @@ function createContext(id,seed,parent) {
}
context = getContextStorage(storage);
}
if (seed) {
if (seed && settings.exportGlobalContextKeys !== false) {
if (callback) {
context.keys(scope, function(err,keys) {
callback(err,Array.from(new Set(seedKeys.concat(keys)).keys()));

View File

@ -205,18 +205,27 @@ module.exports = {
// // - reason: if result is false, the HTTP reason string to return
//},
// Anything in this hash is globally available to all functions.
// It is accessed as context.global.
// eg:
// The following property can be used to seed Global Context with predefined
// values. This allows extra node modules to be made available with the
// Function node.
// For example,
// functionGlobalContext: { os:require('os') }
// can be accessed in a function block as:
// context.global.os
// global.get("os")
functionGlobalContext: {
// os:require('os'),
// jfive:require("johnny-five"),
// 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
// The following property can be used to enable context storage. The configuration