-
Notifications
You must be signed in to change notification settings - Fork 453
dbeaver/pro#5802 feat: table api #3487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
}; | ||
this._history.push(historyEntry); | ||
|
||
row[position.colIdx] = value; |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
library input
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
To fix the issue, we need to ensure that the position
parameter cannot introduce prototype pollution. This can be achieved by explicitly validating that position.rowIdx
and position.colIdx
are numeric indices and do not contain dangerous keys like __proto__
, constructor
, or prototype
.
The best approach is to enhance the isValidPosition
method (if it exists) or add explicit checks in the setCellValue
method to reject invalid or dangerous keys. This ensures that the _data
array is only accessed with safe indices.
-
Copy modified lines R44-R51
@@ -43,4 +43,10 @@ | ||
setCellValue(position: ICellPosition, value: TValue): void { | ||
if (!this.isValidPosition(position)) { | ||
throw new Error(`Invalid cell position: row ${position.rowIdx}, column ${position.colIdx}`); | ||
if ( | ||
!this.isValidPosition(position) || | ||
typeof position.rowIdx !== 'number' || | ||
typeof position.colIdx !== 'number' || | ||
['__proto__', 'constructor', 'prototype'].includes(String(position.rowIdx)) || | ||
['__proto__', 'constructor', 'prototype'].includes(String(position.colIdx)) | ||
) { | ||
throw new Error(`Invalid or unsafe cell position: row ${position.rowIdx}, column ${position.colIdx}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
I like Mutex!
I'm not sure about nanoevents. We have built-in EventTarget, why to add something?
We definitely need to decide how we gonna write private methods/props, using private _method
or #method
.
closes dbeaver/pro#5802