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:
翅膀 committed 2026-10-23 23:21:25 +08:00
1 parent 900962e003
commit 1b6b30066f
2 files changed
+17 -3

No files matched your search

+10
View File
@@ -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,
);
});
});