Skip to content

fix(Codec): fix crash on prototype-less objects#756

Merged
gigobyte merged 1 commit intogigobyte:masterfrom
libre-man:master
Dec 11, 2025
Merged

fix(Codec): fix crash on prototype-less objects#756
gigobyte merged 1 commit intogigobyte:masterfrom
libre-man:master

Conversation

@libre-man
Copy link
Contributor

  • Replace input.hasOwnProperty(key) with Object.prototype.hasOwnProperty.call(input, key) in Codec.ts. This prevents runtime errors when decoding objects created via Object.create(null).
  • Add regression tests for prototype-less objects.
  • Apply formatting and linting fixes to Maybe.ts and Maybe.test.ts.

- Replace `input.hasOwnProperty(key)` with
  `Object.prototype.hasOwnProperty.call(input, key)` in `Codec.ts`.
  This prevents runtime errors when decoding objects created via
  `Object.create(null)`.
- Add regression tests for prototype-less objects.
- Apply formatting and linting fixes to `Maybe.ts` and
  `Maybe.test.ts`.
@gigobyte
Copy link
Owner

Thanks for the contribution, I will release it today by end of day. 😊

@gigobyte gigobyte merged commit ec4fe52 into gigobyte:master Dec 11, 2025
2 checks passed
@libre-man
Copy link
Contributor Author

libre-man commented Dec 12, 2025

Thanks for merging, a release would be great as this could potentially also lead to a DoS attack (by providing json objects with the key hasOwnProperty set).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants