mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix(filter): read only own payload properties
Inherited object properties are not webhook payload data. Read own properties only so JSONPath cannot traverse prototypes.
This commit is contained in:
1 parent
900962e003
commit
1b6b30066f
2 files changed
+17
-3
No files matched your search
@@ -191,3 +191,13 @@ describe("filter-ast pattern engine", () => {
|
||||
expect(evaluateFilterNode({ type: "repo", match: "acme" }, ev)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("filter-ast payload paths", () => {
|
||||
test("never reads inherited properties", () => {
|
||||
const node = { type: "field" as const, path: "constructor", match: "x" };
|
||||
expect(evaluateFilterNode(node, event())).toBe(false);
|
||||
expect(evaluateFilterNode({ type: "field", path: "__proto__", op: "exists" }, event())).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user