Skip to content

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

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

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

Conversation

@tomaioo

@tomaioo tomaioo commented May 25, 2026

Copy link
Copy Markdown

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 config-driven regex construction; behavior for normal HyperFormula instances and typical separators should be unchanged.

Overview
Hardens instance teardown and numeric literal parsing against unsafe inputs and regex injection.

objectDestroy now no-ops on null and non-objects, walks only own keys via Object.keys + hasOwnProperty, and drops redundant casts—so HyperFormula.destroy() is less likely to throw or touch unexpected properties on odd inputs.

NumberLiteralHelper builds separator patterns with a full escapeRegex helper instead of special-casing . only, so arbitrary thousandSeparator / decimalSeparator config values cannot break or subvert the number-matching regex.

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

sequba and others added 5 commits February 20, 2026 13:18
* Fix package-lock file

* Docs: remove CodeSandbox embedded demos and add links to working exa,ples in Stackblitz (handsontable#1621)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Low risk documentation-only changes: adds new guide pages and adjusts
VuePress sidebar navigation with no runtime or API impact.
> 
> **Overview**
> Adds three new AI-focused documentation pages: `ai-sdk`,
`integration-with-langchain`, and `mcp-server`, describing how to use
HyperFormula for deterministic spreadsheet computation in agent
workflows.
> 
> Updates the VuePress guide sidebar to surface these pages under
**Integrations**, renames the section from *Framework integration* to
*Integrations*, and moves the former *Overview* links into a new *About*
section.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
54c541b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: GreenFlux <support@greenflux.us>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
- 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>

@claude claude Bot left a comment

Copy link
Copy Markdown

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

netlify Bot commented May 25, 2026

Copy link
Copy Markdown

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

@sequba sequba changed the base branch from master to develop June 10, 2026 09:02
@netlify

netlify Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploy Preview for hyperformula-dev-docs ready!

Name Link
🔨 Latest commit 0589d32
🔍 Latest deploy log https://app.netlify.com/projects/hyperformula-dev-docs/deploys/6a2928d5c511c800090ad2ed
😎 Deploy Preview https://deploy-preview-1681--hyperformula-dev-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.

@sequba

sequba commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@tomaioo Thank you for contributing to the HyperFormula project.

We found your suggestions valuable, and we'd like to include them in the next HF release. But for legal reasons, we cannot use your code unless you sign our 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.

3 participants