Skip to content

Commit

Permalink
Run tests with --disable-proto=delete (partly for Deno compatibilit…
Browse files Browse the repository at this point in the history
…y) (#1902)
  • Loading branch information
benjie committed Jan 5, 2024
2 parents 12a53b4 + 1b6c2f6 commit 2d41885
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/light-pandas-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tamedevil": patch
---

Forbid `__proto__` set even when `--disable-proto=delete` option is in use.
2 changes: 1 addition & 1 deletion .github/workflows/test-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
TEST_SIMPLIFY_DATABASE_URL: postgres://postgres:postgres@localhost:5432/pg_simplify_inflectors
TERM: xterm
FORCE_COLOR: 1
NODE_OPTIONS: "--max-old-space-size=4096"
NODE_OPTIONS: "--max-old-space-size=4096 --disable-proto=delete"

strategy:
fail-fast: false
Expand Down
5 changes: 5 additions & 0 deletions utils/tamedevil/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ const disallowedKeys: Array<string | symbol | number> = [
...Object.getOwnPropertyNames(Object.prototype),
...Object.getOwnPropertySymbols(Object.prototype),
];
if (!disallowedKeys.includes("__proto__")) {
// If you're running with `--disable-proto=delete` we still want to check
// you're not trying to set __proto__.
disallowedKeys.push("__proto__");
}

/**
* Returns true if the given key is safe to set as the key of a POJO (without a
Expand Down

0 comments on commit 2d41885

Please sign in to comment.