Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests with --disable-proto=delete (partly for Deno compatibility) #1902

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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