-
Notifications
You must be signed in to change notification settings - Fork 111
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
【WIP】Refactor/remove vgrammar #3748
base: develop
Are you sure you want to change the base?
Conversation
56136e9
to
2d22eb9
Compare
1cd8f99
to
5eefaad
Compare
const style = stateStyle[state] ?? { [styleKey]: {} }; | ||
stateStyle[state][styleKey] = { | ||
const style = this.stateStyle[state] ?? { [styleKey]: {} }; | ||
this.stateStyle[state][styleKey] = { |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
library input
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
stateStyle[state][attr] = { | ||
this.stateStyle[state][attr] = { |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
library input
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
stateStyle[state][key as keyof T] = stateStyle.normal[key]; | ||
this.stateStyle[state][key as keyof T] = this.stateStyle.normal[key]; |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
library input
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 11 hours ago
To fix the prototype pollution issue, we need to ensure that the state
parameter cannot be a special property name like __proto__
, constructor
, or prototype
. We can achieve this by adding a check to validate the state
parameter before using it as a key in the this.stateStyle
object.
The best way to fix this problem without changing existing functionality is to add a validation check at the beginning of the setAttribute
method. If the state
parameter is one of the special property names, we can throw an error or handle it appropriately.
-
Copy modified lines R682-R684
@@ -681,2 +681,5 @@ | ||
) { | ||
if (state === '__proto__' || state === 'constructor' || state === 'prototype') { | ||
throw new Error('Invalid state value'); | ||
} | ||
if (this.stateStyle[state] === undefined) { |
373bf46
to
ad58075
Compare
ad58075
to
168aff6
Compare
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
🔗 Related PR link
🐞 Bugserver case id
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough