Skip to content

Commit 4446161

Browse files
andrew-colemanmattbaileyuk
authored andcommitted
Prevent lookup of function object properties
A lambda function is represented internally as a javascript object. A check needs to be added to the `lookup` function to only expose properties if they are a non-function object. Similar to the check that already exists in the `keys` function. Signed-off-by: andrew-coleman <[email protected]>
1 parent b2a637e commit 4446161

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/functions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ const functions = (() => {
16581658
});
16591659
});
16601660
result = keys(merge);
1661-
} else if (arg !== null && typeof arg === 'object' && !(isLambda(arg))) {
1661+
} else if (arg !== null && typeof arg === 'object' && !isFunction(arg)) {
16621662
Object.keys(arg).forEach(key => result.push(key));
16631663
}
16641664
return result;
@@ -1685,7 +1685,7 @@ const functions = (() => {
16851685
}
16861686
}
16871687
}
1688-
} else if (input !== null && typeof input === 'object') {
1688+
} else if (input !== null && typeof input === 'object' && !isFunction(input)) {
16891689
result = input[key];
16901690
}
16911691
return result;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"expr": "( $f := function(){1}; $f.environment )",
3+
"dataset": null,
4+
"bindings": {},
5+
"undefinedResult": true
6+
}

0 commit comments

Comments
 (0)