mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Prevent function module overwriting built-in sandbox properties
This commit is contained in:
@@ -1438,7 +1438,6 @@ describe('function node', function() {
|
||||
}
|
||||
},20);
|
||||
}).catch(err => done(err));
|
||||
|
||||
})
|
||||
it('should require the OS module', function(done) {
|
||||
var flow = [
|
||||
@@ -1459,9 +1458,18 @@ describe('function node', function() {
|
||||
});
|
||||
n1.receive({payload:"foo",topic: "bar"});
|
||||
}).catch(err => done(err));
|
||||
|
||||
})
|
||||
|
||||
it('should fail if module variable name clashes with sandbox builtin', function(done) {
|
||||
var flow = [
|
||||
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;", "libs": [{var:"flow", module:"os"}]},
|
||||
{id:"n2", type:"helper"}
|
||||
];
|
||||
helper.load(functionNode, flow, function() {
|
||||
var n1 = helper.getNode("n1");
|
||||
should.not.exist(n1);
|
||||
done();
|
||||
}).catch(err => done(err));
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
@@ -94,7 +94,7 @@ describe("externalModules api", function() {
|
||||
it("installs missing modules", async function() {
|
||||
externalModules.init({userDir: homeDir});
|
||||
externalModules.register("function", "libs");
|
||||
fs.existsSync(path.join(homeDir,"externalModuels")).should.be.false();
|
||||
fs.existsSync(path.join(homeDir,"externalModules")).should.be.false();
|
||||
await externalModules.checkFlowDependencies([
|
||||
{type: "function", libs:[{module: "foo"}]}
|
||||
])
|
||||
|
Reference in New Issue
Block a user