-
Notifications
You must be signed in to change notification settings - Fork 25
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
[Auto Sync] Sync the code from branch main to branch develop after release 1.2.13 #168
Conversation
540370d
to
baff96d
Compare
.github/workflows/pr-check.yml
Outdated
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
cache-dependency-path: './common/config/rush/pnpm-lock.yaml' | ||
|
||
- uses: xile611/pr-type-check@main | ||
with: | ||
pull_request_body: | | ||
${{ github.event.pull_request.body }} | ||
pull_request_head: ${{ github.event.pull_request.head.ref }} |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
.github/workflows/pr-check.yml
Outdated
cache: 'npm' | ||
cache-dependency-path: './common/config/rush/pnpm-lock.yaml' | ||
|
||
- uses: xile611/pr-type-check@main |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
.github/workflows/pre-release.yml
Outdated
|
||
- name: Parse semver version from branch name | ||
id: semver_parser | ||
uses: xile611/read-package-version-action@main |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step: semver_parser
.github/workflows/pre-release.yml
Outdated
|
||
- name: Get npm version | ||
id: package-version | ||
uses: xile611/read-package-version-action@main |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step: package-version
.github/workflows/pre-release.yml
Outdated
path: packages/vmind | ||
|
||
- name: Commit & Push changes | ||
uses: actions-js/push@master |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
.github/workflows/release.yml
Outdated
|
||
- name: Create Release for Tag | ||
id: release_tag | ||
uses: ncipollo/[email protected] |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step: release_tag
.github/workflows/release.yml
Outdated
draft: true # | ||
|
||
- name: Create Pull Request | ||
uses: dustinirving/[email protected] |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
|
||
- name: Get version | ||
id: package-version | ||
uses: xile611/read-package-version-action@main |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step: package-version
git push origin sync/main-${{ steps.package-version.outputs.current_version }} | ||
|
||
- name: Create Pull Request | ||
uses: dustinirving/[email protected] |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
.github/workflows/unit-test.yml
Outdated
runs-on: macOS-12 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
cache-dependency-path: './common/config/rush/pnpm-lock.yaml' | ||
|
||
# Install rush | ||
- name: Install rush | ||
run: node common/scripts/install-run-rush.js install --bypass-policy | ||
|
||
- name: Compile | ||
run: node common/scripts/install-run-rush.js compile --only tag:package | ||
- name: Test | ||
run: node common/scripts/install-run-rush.js test --only tag:package |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
const result = spawnSync('sh', ['-c', `echo ${message} | ${commitLintBinPath} --config ${commitLineConfigPath}`], { | ||
stdio: 'inherit' | ||
}); |
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium
absolute path
This shell command depends on an uncontrolled
absolute path
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 8 days ago
To fix the problem, we should avoid constructing the shell command as a single string and instead pass the command and its arguments separately to spawnSync
. This approach prevents the shell from interpreting special characters in the arguments, thus mitigating the risk of shell injection.
We will:
- Replace the dynamic shell command construction with separate command and arguments.
- Use
spawnSync
without the-c
option to avoid shell interpretation.
-
Copy modified lines R34-R35 -
Copy modified lines R51-R52 -
Copy modified lines R56-R57 -
Copy modified lines R60-R61
@@ -33,3 +33,4 @@ | ||
} else { | ||
const result = spawnSync('sh', ['-c', `echo ${message} | ${commitLintBinPath} --config ${commitLineConfigPath}`], { | ||
const result = spawnSync(commitLintBinPath, ['--config', commitLineConfigPath], { | ||
input: message, | ||
stdio: 'inherit' | ||
@@ -49,5 +50,4 @@ | ||
|
||
spawnSync('sh', ['-c', `rush change --bulk --bump-type '${bumpType}' --message '${message}'`], { | ||
stdio: 'inherit', | ||
shell: false | ||
spawnSync('rush', ['change', '--bulk', '--bump-type', bumpType, '--message', message], { | ||
stdio: 'inherit' | ||
}); | ||
@@ -55,10 +55,8 @@ | ||
if (!notCommit) { | ||
spawnSync('sh', ['-c', 'git add --all'], { | ||
stdio: 'inherit', | ||
shell: false | ||
spawnSync('git', ['add', '--all'], { | ||
stdio: 'inherit' | ||
}); | ||
|
||
spawnSync('sh', ['-c', `git commit -m 'docs: update changlog of rush'`], { | ||
stdio: 'inherit', | ||
shell: false | ||
spawnSync('git', ['commit', '-m', 'docs: update changlog of rush'], { | ||
stdio: 'inherit' | ||
}); |
const result = child_process.spawnSync( | ||
"sh", | ||
["-c", `${commitlintBinPath} --config ${configPath} --cwd ${path.dirname(gitPath)} --edit`], | ||
{ | ||
stdio: "inherit", | ||
}, | ||
); |
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium
absolute path
This shell command depends on an uncontrolled
absolute path
This shell command depends on an uncontrolled
absolute path
This shell command depends on an uncontrolled
absolute path
This shell command depends on an uncontrolled
absolute path
This shell command depends on an uncontrolled
absolute path
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 8 days ago
To fix the problem, we should avoid passing the entire command string to the shell. Instead, we can use child_process.spawnSync
with the command and arguments provided separately. This way, the shell will not interpret any special characters in the paths.
- Replace the dynamic command string with an array of arguments.
- Use
child_process.spawnSync
without thesh -c
option to avoid shell interpretation.
-
Copy modified lines R15-R16
@@ -14,4 +14,4 @@ | ||
const result = child_process.spawnSync( | ||
"sh", | ||
["-c", `${commitlintBinPath} --config ${configPath} --cwd ${path.dirname(gitPath)} --edit`], | ||
commitlintBinPath, | ||
["--config", configPath, "--cwd", path.dirname(gitPath), "--edit"], | ||
{ |
common/scripts/sort_deps.js
Outdated
spawnSync('sh', ['-c', `prettier -w ${pkgJsonPath}`], { | ||
stdio: 'inherit', | ||
shell: false, | ||
}) |
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium
absolute path
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 8 days ago
To fix the problem, we should avoid constructing the shell command dynamically with user-controlled input. Instead, we can pass the arguments to the command separately to ensure they are not interpreted by the shell. This can be achieved by using spawnSync
without the -c
option and passing the arguments as an array.
-
Copy modified line R93 -
Copy modified line R106
@@ -92,5 +92,4 @@ | ||
|
||
spawnSync('sh', ['-c', `prettier -w ${pkgJsonPath}`], { | ||
spawnSync('prettier', ['-w', pkgJsonPath], { | ||
stdio: 'inherit', | ||
shell: false, | ||
}) | ||
@@ -106,5 +105,4 @@ | ||
|
||
spawnSync('sh', ['-c', `prettier -w ${pkgJsonPath}`], { | ||
spawnSync('prettier', ['-w', pkgJsonPath], { | ||
stdio: 'inherit', | ||
shell: false, | ||
}) |
common/scripts/sort_deps.js
Outdated
spawnSync('sh', ['-c', `prettier -w ${pkgJsonPath}`], { | ||
stdio: 'inherit', | ||
shell: false, | ||
}) |
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium
absolute path
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 8 days ago
To fix the problem, we should avoid constructing the shell command as a single string that the shell interprets. Instead, we should use spawnSync
with separate arguments to ensure that the file path is not interpreted by the shell. This can be achieved by passing the command and its arguments as separate elements in an array.
-
Copy modified line R93 -
Copy modified line R107
@@ -92,3 +92,3 @@ | ||
|
||
spawnSync('sh', ['-c', `prettier -w ${pkgJsonPath}`], { | ||
spawnSync('prettier', ['-w', pkgJsonPath], { | ||
stdio: 'inherit', | ||
@@ -106,3 +106,3 @@ | ||
|
||
spawnSync('sh', ['-c', `prettier -w ${pkgJsonPath}`], { | ||
spawnSync('prettier', ['-w', pkgJsonPath], { | ||
stdio: 'inherit', |
docs/src/markdown.tsx
Outdated
|
||
function htmlRestore(str: string) { | ||
let result = ''; | ||
result = str.replace(/&/g, '&'); |
Check failure
Code scanning / CodeQL
Double escaping or unescaping High documentation
here
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 8 days ago
To fix the problem, we need to adjust the order of unescaping in the htmlRestore
function. Specifically, we should unescape the ampersand (&
) last to ensure that other entities are correctly unescaped first. This change will prevent any issues related to double unescaping.
-
Copy modified line R51 -
Copy modified line R56
@@ -50,4 +50,3 @@ | ||
let result = ''; | ||
result = str.replace(/&/g, '&'); | ||
result = result.replace(/</g, '<'); | ||
result = str.replace(/</g, '<'); | ||
result = result.replace(/>/g, '>'); | ||
@@ -56,2 +55,3 @@ | ||
result = result.replace(/"/g, '"'); | ||
result = result.replace(/&/g, '&'); | ||
return result; |
}; | ||
|
||
const isStringArray = (str: string) => { | ||
const regex = /^(.*)\: ".+"(, ".+")+$/; |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 8 days ago
To fix the problem, we need to modify the regular expression to remove the ambiguity that causes exponential backtracking. Specifically, we can replace the .*
and .+
patterns with more specific patterns that do not overlap in ambiguous ways. This can be achieved by using negated character classes to ensure that each part of the regular expression matches a distinct set of characters.
- Replace
.*
with[^:]*
to match any sequence of characters that does not include a colon. - Replace
.+
with[^"]+
to match any sequence of characters that does not include a double quote.
These changes will ensure that the regular expression is more efficient and does not suffer from exponential backtracking.
-
Copy modified line R52
@@ -51,3 +51,3 @@ | ||
const isStringArray = (str: string) => { | ||
const regex = /^(.*)\: ".+"(, ".+")+$/; | ||
const regex = /^([^:]+)\: "[^"]+"(, "[^"]+")+$/; | ||
return regex.test(str); |
packages/vmind/src/core/VMind.ts
Outdated
this._applicationMap[name] = {}; | ||
} | ||
this._applicationMap[name][modelType] = new BaseApplication(applicationMeta); | ||
return; |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
library input
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 8 days ago
To fix the problem, we need to ensure that the name
property from applicationMeta
cannot be used to modify Object.prototype
. This can be achieved by checking if name
is one of the dangerous values (__proto__
, constructor
, prototype
) before using it as a key in the assignment. If name
matches any of these values, we should throw an error or handle it appropriately.
-
Copy modified lines R66-R68
@@ -65,2 +65,5 @@ | ||
const { name } = applicationMeta; | ||
if (name === '__proto__' || name === 'constructor' || name === 'prototype') { | ||
throw new Error('Invalid application name'); | ||
} | ||
if (!this._applicationMap[name]) { |
packages/vmind/src/core/VMind.ts
Outdated
if (originalTaskNode) { | ||
originalTaskNode.taskNode = taskNode.taskNode; | ||
this._applicationMap[applicationName][modelType] = new BaseApplication(applicationMeta); | ||
} else { |
Check warning
Code scanning / CodeQL
Prototype-polluting assignment Medium
library input
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 8 days ago
To fix the problem, we need to ensure that applicationName
cannot be a dangerous value like __proto__
, constructor
, or prototype
. One way to do this is to validate applicationName
before using it as a key in an object assignment. We can add a check to ensure that applicationName
does not match any of these dangerous values. If it does, we can throw an error or handle it appropriately.
-
Copy modified lines R74-R76
@@ -73,2 +73,5 @@ | ||
setTaskNode(applicationName: string, modelType: ModelType | string, taskNode: TaskNode<any>) { | ||
if (applicationName === '__proto__' || applicationName === 'constructor' || applicationName === 'prototype') { | ||
throw 'Invalid application name!'; | ||
} | ||
const applicationMeta = this._runtimeMetaMap[applicationName]?.[modelType]; |
Sync the code from branch main to branch develop after release 1.2.13