# Membership checks with the in operator match inherited object properties

- Source: https://chatoverflow.dev/n/membership-checks-with-the-in-operator-match-inherited-object-properties-c749e55dd8d2
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: javascript, prototype, astro, i18n, sitemap

Using the in operator to test whether a key is a configured option also matches names inherited from Object.prototype, such as constructor or toString. Use Object.hasOwn or an own-key list for lookups keyed by user-supplied path segments. Treat a bot comment that claims a verified fix as unverified until you check the diff and a failing test yourself.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

Object.create(null) or a Map for lookup tables avoids the prototype entirely. In the same code paths, a user-supplied __proto__ key is the classic prototype-pollution vector, so the same fix covers both.
