Skip to content

Feat/vchart editor:Add VChartSpec Atom and demo of vchart editor #197

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

Merged
merged 69 commits into from
Mar 19, 2025

Conversation

666haiwen
Copy link
Contributor

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Release
  • Site / documentation update
  • Demo update
  • Workflow
  • Other (about what?)

🔗 Related issue link

🔗 Related PR link

🐞 Bugserver case id

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

666haiwen and others added 30 commits December 4, 2024 17:42
@@ -52,10 +52,15 @@
sparse_vector: (sparseVector ?? [])
.map(item => {
// 使用正则表达式解析字符串
const match = item.match(/\('(.+)', ([\d.]+)\)/);
const match = item.match(/\("(.+?)", ([\d.]+)\)/);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '("' and with many repetitions of '("a'.
This
regular expression
that depends on
library input
may run slow on strings starting with '("' and with many repetitions of '("a'.
if (match) {
return [match[1], parseFloat(match[2])];
}
const oldMatch = item.match(/\('(.+)', ([\d.]+)\)/);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '('' and with many repetitions of '('a'.
This
regular expression
that depends on
library input
may run slow on strings starting with '('' and with many repetitions of '('a'.
if (isValid(nested[key])) {
merge(nested, { [key]: newValue });
} else {
nested[key] = newValue;

Check warning

Code scanning / CodeQL

Prototype-polluting function Medium

The property chain
here
is recursively assigned to
nested
without guarding against prototype pollution.

Copilot Autofix

AI 3 months ago

To fix the problem, we need to ensure that the key variable does not include any properties that can lead to prototype pollution, such as __proto__ or constructor. We can achieve this by adding a check to skip these properties before performing the assignment.

  • Add a check to skip __proto__ and constructor properties in the baseSet function.
  • This change should be made in the baseSet function in the file packages/vmind/src/utils/set.ts.
Suggested changeset 1
packages/vmind/src/utils/set.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/vmind/src/utils/set.ts b/packages/vmind/src/utils/set.ts
--- a/packages/vmind/src/utils/set.ts
+++ b/packages/vmind/src/utils/set.ts
@@ -65,2 +65,5 @@
     const key = path[index];
+    if (key === "__proto__" || key === "constructor") {
+      continue;
+    }
     let newValue = value;
EOF
@@ -65,2 +65,5 @@
const key = path[index];
if (key === "__proto__" || key === "constructor") {
continue;
}
let newValue = value;
Copilot is powered by AI and may make mistakes. Always verify output.
@xile611 xile611 merged commit 2f584a1 into develop Mar 19, 2025
5 of 6 checks passed
@xile611 xile611 deleted the feat/vchart_editor branch March 19, 2025 02:15
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.

2 participants