Merged
Conversation
1cd8f99 to
5eefaad
Compare
| // 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
| // 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
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 12 months ago
To fix the prototype pollution vulnerability, we need to ensure that the state parameter cannot be one of the special property names (__proto__, constructor, prototype). We can achieve this by adding a validation check before using the state parameter as a key in the this.stateStyle object. If the state parameter matches any of these special property names, we should throw an error or handle it appropriately.
Suggested changeset
1
packages/vchart/src/mark/base/base-mark.ts
| @@ -681,2 +681,5 @@ | ||
| ) { | ||
| if (state === '__proto__' || state === 'constructor' || state === 'prototype') { | ||
| throw new Error('Invalid state value'); | ||
| } | ||
| if (this.stateStyle[state] === undefined) { |
Copilot is powered by AI and may make mistakes. Always verify output.
ad58075 to
168aff6
Compare
6326ada to
c469a13
Compare
xiaoluoHe
approved these changes
Mar 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[中文版模板 / 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