Skip to content

[Auto release] release 2.0.0#4026

Merged
xile611 merged 155 commits into
mainfrom
release/2.0.0
Jun 11, 2025
Merged

[Auto release] release 2.0.0#4026
xile611 merged 155 commits into
mainfrom
release/2.0.0

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🆕 feat

🐛 fix

🔨 refactor

  • @visactor/vchart: migrate mapLabel component into vchart-extension package

xiaoluoHe and others added 30 commits March 13, 2025 15:57
refactor: add mark api `hasAnimationByState`
@github-actions github-actions Bot requested a review from kkxxkk2019 June 10, 2025 14:08
Comment thread packages/vchart/src/mark/base/base-mark.ts Dismissed
// 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

This assignment may alter Object.prototype if a malicious '__proto__' string is injected from
library input
.

Copilot Autofix

AI 11 months ago

To fix the issue, we need to prevent the state parameter from being used as a key if it contains a value that could lead to prototype pollution. This can be achieved by validating the state parameter before using it. Specifically:

  1. Reject keys such as __proto__, constructor, and prototype that could lead to prototype pollution.
  2. Add a check at the beginning of the setAttribute method to ensure state is valid.

This fix ensures that malicious input cannot exploit the vulnerability while preserving the existing functionality of the code.

Suggested changeset 1
packages/vchart/src/mark/base/base-mark.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/vchart/src/mark/base/base-mark.ts b/packages/vchart/src/mark/base/base-mark.ts
--- a/packages/vchart/src/mark/base/base-mark.ts
+++ b/packages/vchart/src/mark/base/base-mark.ts
@@ -724,2 +724,7 @@
   ) {
+    // Validate the state parameter to prevent prototype pollution
+    if (state === '__proto__' || state === 'constructor' || state === 'prototype') {
+      throw new Error(`Invalid state key: ${state}`);
+    }
+
     if (this.stateStyle[state] === undefined) {
EOF
@@ -724,2 +724,7 @@
) {
// Validate the state parameter to prevent prototype pollution
if (state === '__proto__' || state === 'constructor' || state === 'prototype') {
throw new Error(`Invalid state key: ${state}`);
}

if (this.stateStyle[state] === undefined) {
Copilot is powered by AI and may make mistakes. Always verify output.
// 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

This assignment may alter Object.prototype if a malicious '__proto__' string is injected from
library input
.

Copilot Autofix

AI 11 months ago

To fix the issue, we need to ensure that the state parameter cannot be used to modify Object.prototype. This can be achieved by validating the state parameter before using it as a key in the this.stateStyle object. Specifically, we can check if state is one of the expected values and reject any unexpected or malicious values such as __proto__, constructor, or prototype.

The best way to fix this issue is to add a validation step for the state parameter at the beginning of the setAttribute method. If state contains a disallowed value, the method should throw an error or return early.


Suggested changeset 1
packages/vchart/src/mark/base/base-mark.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/vchart/src/mark/base/base-mark.ts b/packages/vchart/src/mark/base/base-mark.ts
--- a/packages/vchart/src/mark/base/base-mark.ts
+++ b/packages/vchart/src/mark/base/base-mark.ts
@@ -724,2 +724,7 @@
   ) {
+    // Validate the state parameter to prevent prototype pollution
+    if (state === '__proto__' || state === 'constructor' || state === 'prototype') {
+      throw new Error(`Invalid state value: ${state}`);
+    }
+
     if (this.stateStyle[state] === undefined) {
EOF
@@ -724,2 +724,7 @@
) {
// Validate the state parameter to prevent prototype pollution
if (state === '__proto__' || state === 'constructor' || state === 'prototype') {
throw new Error(`Invalid state value: ${state}`);
}

if (this.stateStyle[state] === undefined) {
Copilot is powered by AI and may make mistakes. Always verify output.
@xile611 xile611 merged commit 6aa6787 into main Jun 11, 2025
6 of 9 checks passed
@xile611 xile611 deleted the release/2.0.0 branch June 11, 2025 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants