Skip to content

fix(security): 2 improvements across 2 files#1681

Open
tomaioo wants to merge 2 commits into
handsontable:masterfrom
tomaioo:fix/security/potential-prototype-pollution-in-objectd
Open

fix(security): 2 improvements across 2 files#1681
tomaioo wants to merge 2 commits into
handsontable:masterfrom
tomaioo:fix/security/potential-prototype-pollution-in-objectd

Conversation

@tomaioo
Copy link
Copy Markdown

@tomaioo tomaioo commented May 25, 2026

Summary

fix(security): 2 improvements across 2 files

Problem

Severity: Medium | File: src/Destroy.ts:L6

The objectDestroy function iterates over all object entries and deletes properties or replaces methods. If this function is ever called with an object that has a prototype chain, or if Object.entries includes inherited properties (though it doesn't by default), this could lead to unexpected behavior. More critically, the function accepts any type and doesn't validate the input, which could cause issues if called with null/undefined or non-object types.

Solution

Add input validation to ensure object is a non-null object. Consider using Object.keys instead of Object.entries for better control, and explicitly check hasOwnProperty to avoid touching prototype properties.

Changes

  • src/Destroy.ts (modified)
  • src/NumberLiteralHelper.ts (modified)

Note

Low Risk
Small defensive changes to destroy teardown and number-pattern construction; no auth, data, or API contract changes.

Overview
Hardens instance teardown in objectDestroy (used by HyperFormula.destroy()): non-objects are ignored, iteration uses own keys only, and methods are stubbed without touching inherited properties.

Number parsing now escapes all regex metacharacters in configured thousand/decimal separators when building number patterns, instead of only treating . specially—so unusual separator characters cannot break or abuse the constructed RegExp.

Reviewed by Cursor Bugbot for commit fd8eb55. Bugbot is set up for automated code reviews on this repo. Configure here.

tomaioo added 2 commits May 25, 2026 05:34
- Security: Potential Prototype Pollution in objectDestroy
- Security: Unsafe Regular Expression Construction in NumberLiteralHelper

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
- Security: Potential Prototype Pollution in objectDestroy
- Security: Unsafe Regular Expression Construction in NumberLiteralHelper

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 25, 2026

Deploy Preview for hyperformula-docs ready!

Name Link
🔨 Latest commit fd8eb55
🔍 Latest deploy log https://app.netlify.com/projects/hyperformula-docs/deploys/6a1441c285be2a000851dc42
😎 Deploy Preview https://deploy-preview-1681--hyperformula-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fd8eb55. Configure here.

Comment thread src/Destroy.ts
for (const key of Object.keys(object)) {
if (!Object.prototype.hasOwnProperty.call(object, key)) {
continue
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant hasOwnProperty check after Object.keys

Low Severity

The hasOwnProperty guard is redundant here because Object.keys() already returns only an object's own enumerable properties by specification. The condition !Object.prototype.hasOwnProperty.call(object, key) can never be true for keys returned by Object.keys(object), making this a dead branch that adds unnecessary complexity without any protective benefit.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fd8eb55. Configure here.

@AMBudnik
Copy link
Copy Markdown
Contributor

Hi @tomaioo

Thank you very much for taking the time to propose a solution.

Could you please also sign our CLA? Without the signature, we won't be able to merge the code.

CLA: https://docs.google.com/forms/d/e/1FAIpQLScpMq4swMelvw3-onxC8Jl29m0fVp5hpf7d1yQVklqVjGjWGA/viewform?c=0&w=1

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