You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VocabularyManager.getTerm returns Object.prototype built-ins for property names that shadow Object.prototype (hasOwnProperty, constructor, toString, …) #1241
VocabularyManager.getTerm returns a built-in Object.prototype method (a Function) instead of the YAML vocabulary string when a property name matches a key on Object.prototype — such as hasOwnProperty, constructor, or toString.
Each element d in decl.properties is a plain {} object. For any propertyName that exists on Object.prototype, d[propertyName] walks the prototype chain and returns the built-in method — which is truthy. As a result:
find always returns the first element in the array (all plain objects inherit these)
property[propertyName] on line 144 then returns the built-in Object.prototype method
The caller receives a Function, not the vocabulary string
Note: the fix proposed in #1184 (propertyName in d) does not fix this — 'hasOwnProperty' in {} also returns true via the prototype chain. The correct fix is Object.prototype.hasOwnProperty.call(d, propertyName).
Any name present on Object.prototype: hasOwnProperty, constructor, toString, valueOf, isPrototypeOf, propertyIsEnumerable, toLocaleString
Possible Solution
Replace the plain property access on line 143 of vocabulary.js with an own-property check:
// Before — traverses the prototype chain; shadowed by Object.prototype built-insconstproperty=decl.properties.find(d=>d[propertyName]);// After — checks only own properties; immune to prototype shadowing// and also fixes falsy-value coercion (see #1183) as a side-effectconstproperty=decl.properties.find(d=>Object.prototype.hasOwnProperty.call(d,propertyName));
This single-line change also subsumes the falsy-value fix from #1183 because Object.prototype.hasOwnProperty.call tests key existence, not value truthiness — so "", false, and 0 are handled correctly too.
#1183 covers falsy-value coercion ("", false, 0 → null). The proposed fix there (propertyName in d) would partially address falsy values but would not resolve this prototype pollution bug. Using Object.prototype.hasOwnProperty.call(d, propertyName) fixes both issues with a single change.
This issue is stale because it has been open with no activity. Remove the stale label or comment to keep it active. Only items with maintainer engagement are auto-closed.
Activity
github-actions commentedon Jul 26, 2026
This issue is stale because it has been open with no activity. Remove the stale label or comment to keep it active. Only items with maintainer engagement are auto-closed.