# biome suspicious/noPrototypeBuiltins: fix changes program behavior

Internal evidence sheet generated by fixhunt. Not an issue text. A human re-verifies, checks the duplicates
below, and writes the upstream report in their own words following the project's AI policy.

- Tool: biome 2.5.15
- Rule: suspicious/noPrototypeBuiltins (tool labels the fix: safe, this fix reported as safe)
- Oracle: fix-changes-behavior
- Judge (Nemotron 3 Ultra, advisory): intended-change, severity high. The program deliberately shadows hasOwnProperty on obj with a non-function value (42). The rule exists precisely to bypass such shadowing by rewriting obj.hasOwnProperty('x') to Object.hasOwn(obj, 'x'). Before the fix the call throws a TypeError (caught silently, no output); after the fix Object.hasOwn correctly returns false, which is printed. This behavioral change is the documented purpose of the rule, not a bug in the fix.
- Program: minimized from 12 to 9 lines

## Reproducer

```js
const obj = {};
Object.defineProperty(obj, 'hasOwnProperty', { value: 42, writable: false });
try {
  console.log(obj.hasOwnProperty('x'));
} catch (e) {
}
try {
} catch (e) {
}
```

## Commands

```sh
node prog.js
bunx @biomejs/biome lint --only=suspicious/noPrototypeBuiltins --write prog.js
node prog.js
```

## Observed

```
stdout before:

stdout after:
false
```

## Diff applied by the fix

```diff
--- orig.js	2026-10-22 13:36:37.986234258 -0400
+++ fixed.js	2026-10-22 13:36:39.993268164 -0400
@@ -1,7 +1,7 @@
 const obj = {};
 Object.defineProperty(obj, 'hasOwnProperty', { value: 42, writable: false });
 try {
-  console.log(obj.hasOwnProperty('x'));
+  console.log(Object.hasOwn(obj, 'x'));
 } catch (e) {
 }
 try {
```

## Why the rewrite is not equivalent (model draft, verify before use)

The original call uses `obj.hasOwnProperty`, which accesses the overridden property defined on `obj` that returns the number 42, so `console.log(42)` outputs `42`. The fix replaces it with `Object.hasOwn(obj, 'x')`, which calls the built-in method unaffected by the override, correctly returning `false` since `obj` has no own property `'x'`. Thus, the behavior changes from logging `42` to logging `false`.

## Upstream search

Queries: "noPrototypeBuiltins fix", "suspicious noPrototypeBuiltins hasOwnProperty call", "suspicious noPrototypeBuiltins object method override", "suspicious noPrototypeBuiltins prototype property shadowing"

- related: https://github.com/biomejs/biome/issues/10769
  useLiteralKeys flags __proto__ in computed member expression with unsafe fix conflicting with noProto, same rule family (prototype builtins) but different construct

<details><summary>All hits</summary>

- [github, open] 💅 `useSortedProperties` can produce invalid CSS when the final semicolon is omitted — https://github.com/biomejs/biome/issues/12417
- [github, open] 💅 `useSortedProperties` moves Sass variable declarations below their uses — https://github.com/biomejs/biome/issues/12414
- [github, open] 💅 `useSortedProperties` can change behavior when reordering nested CSS rules — https://github.com/biomejs/biome/issues/12413
- [github, open] 💅 `noUnnecessaryConditions`: false positive on an overloaded call with `undefined` as the default argument (Vue `inject`) — https://github.com/biomejs/biome/issues/12040
- [github, open] 💅 `noSkippedTests` conditionally skip fix suggestion — https://github.com/biomejs/biome/issues/9295
- [github, open] 💅 Actually used private method considered unused — https://github.com/biomejs/biome/issues/8185
- [github, open] 💅 cannot detect that the StrictMode component of React is being exported. — https://github.com/biomejs/biome/issues/10609
- [github, open] 💅 noUnnecessaryConditions callback overload false positive — https://github.com/biomejs/biome/issues/11439
- [github, open] 💅 lint/a11y/useAnchorContent: the PascalCase component allowance is applied only to self-closing elements — https://github.com/biomejs/biome/issues/11872
- [github, open] 💅 useLiteralKeys flags `__proto__` in a computed member expression and offers an unsafe fix that conflicts with noProto — https://github.com/biomejs/biome/issues/10769
- [github, closed] 💅 `noThisInStatic` safe fix is not safe — https://github.com/biomejs/biome/issues/10011

</details>
