Files
openclaw/src/infra/prototype-keys.test.ts
2026-03-14 01:01:27 +00:00

15 lines
502 B
TypeScript

import { describe, expect, it } from "vitest";
import { isBlockedObjectKey } from "./prototype-keys.js";
describe("isBlockedObjectKey", () => {
it("blocks prototype-pollution keys and allows ordinary keys", () => {
for (const key of ["__proto__", "prototype", "constructor"]) {
expect(isBlockedObjectKey(key)).toBe(true);
}
for (const key of ["toString", "value", "constructorName", "__proto__x", "Prototype"]) {
expect(isBlockedObjectKey(key)).toBe(false);
}
});
});