Repository navigation
fix(env): pass Object.prototype members through the env proxy - #725
Merged
Merged
Conversation
`readKey` looked keys up with `registry.schema[key]`, which also finds inherited members. With a schema registered, `env.hasOwnProperty`, `env.constructor` and `String(env)` treated those members as validators and threw a TypeError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
env.tsregisters a schema, reading anObject.prototypemember fromenvthrows:readKeylooks the key up withregistry.schema[key], which also finds inherited members, and treats them as validators. Without a schema, the same expressions work.Fix
readKeychecks the key withObject.hasOwn, so these members pass through like any key the schema doesn't declare.Tests
packages/void/test/unit/env-schema.test.ts: the three reads above with a registered schema. The case fails without this fix.Verification
vp test run: 776 files pass, 1 skipped (16,002 tests pass, 29 skipped).vp run check: 33/33 pass.playground/ssrwith anenv.ts: a route that makes these reads answers 200 invp devandvp preview.🤖 Generated with Claude Code