-
Notifications
You must be signed in to change notification settings - Fork 84
[Auto release] release 1.3.1 #170
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
Conversation
963c635 to
b5c9e78
Compare
| 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
| 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
|
|
||
| - 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
|
|
||
| - 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
| 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
|
|
||
| - 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
| 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
| 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 11 months ago
To fix the problem, we should avoid constructing the shell command as a single string that the shell interprets. Instead, we should use the execFileSync or spawnSync functions with an array of arguments to pass the dynamic parts separately. This prevents the shell from misinterpreting special characters or spaces in the paths or message.
- Replace the
spawnSynccall on line 34 with a call toexecFileSyncorspawnSyncthat passes the command and arguments separately. - Similarly, replace the
spawnSynccall on line 50 with a call that passes the command and arguments separately. - Ensure that the
messageandbumpTypevariables are properly sanitized or escaped if necessary.
-
Copy modified lines R34-R35 -
Copy modified line R51
| @@ -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,3 +50,3 @@ | ||
|
|
||
| spawnSync('sh', ['-c', `rush change --bulk --bump-type '${bumpType}' --message '${message}'`], { | ||
| spawnSync('rush', ['change', '--bulk', '--bump-type', bumpType, '--message', message], { | ||
| 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 11 months 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 child_process.spawnSync. This way, the shell does not interpret the arguments, and we avoid issues with special characters in paths.
- Replace the dynamic command string with an array of arguments.
- Use
child_process.spawnSyncwithout thesh -coption to directly execute the command with the provided arguments.
-
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"], | ||
| { |
| 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 11 months ago
To fix the problem, we should avoid constructing the command string dynamically and instead pass the command and its arguments separately to spawnSync. This approach ensures that the arguments are not interpreted by the shell, thus preventing potential injection attacks.
We will modify the spawnSync calls to use execFileSync instead, passing the command and arguments as separate parameters. This change will be made in both instances where spawnSync is used.
-
Copy modified lines R93-R94 -
Copy modified lines R106-R107
| @@ -92,5 +92,4 @@ | ||
|
|
||
| spawnSync('sh', ['-c', `prettier -w ${pkgJsonPath}`], { | ||
| stdio: 'inherit', | ||
| shell: false, | ||
| spawnSync('prettier', ['-w', pkgJsonPath], { | ||
| stdio: 'inherit' | ||
| }) | ||
| @@ -106,5 +105,4 @@ | ||
|
|
||
| spawnSync('sh', ['-c', `prettier -w ${pkgJsonPath}`], { | ||
| stdio: 'inherit', | ||
| shell: false, | ||
| spawnSync('prettier', ['-w', pkgJsonPath], { | ||
| stdio: 'inherit' | ||
| }) |
| 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 11 months ago
To fix the problem, we should avoid constructing the command string dynamically and instead pass the command and its arguments separately to spawnSync. This approach ensures that the arguments are not interpreted by the shell, preventing any possibility of command injection.
- Replace the dynamically constructed command string with separate command and arguments.
- Use
spawnSyncwith theprettiercommand and the-wargument followed by thepkgJsonPath.
-
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', |
|
|
||
| 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 11 months ago
To fix the problem, we need to ensure that the htmlRestore function unescapes the ampersand (&) last. This will prevent any issues with double unescaping, ensuring that other entities are correctly decoded before the ampersand is processed.
- Change the order of the replacements in the
htmlRestorefunction. - Specifically, move the line
result = result.replace(/&/g, '&');to the end of the function.
-
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 11 months ago
To fix the problem, we need to remove the ambiguity in the regular expression. The main issue is with the .* and .+ patterns, which can match overlapping parts of the input string. We can replace .* with a more specific pattern that matches any character except a double quote, ensuring that the regular expression remains efficient.
- Replace
.*with[^"]*to match any character except a double quote. - Ensure that the regular expression still matches the intended input strings without causing performance issues.
-
Copy modified line R52
| @@ -51,3 +51,3 @@ | ||
| const isStringArray = (str: string) => { | ||
| const regex = /^(.*)\: ".+"(, ".+")+$/; | ||
| const regex = /^([^"]*)\: ".+"(, ".+")+$/; | ||
| return regex.test(str); |
| 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 11 months ago
To fix the problem, we need to ensure that the name property from applicationMeta cannot be used to modify Object.prototype. We can achieve this by checking if name is one of the special properties (__proto__, constructor, prototype) and rejecting it if so. This will prevent prototype pollution while maintaining the existing functionality.
-
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]) { |
| 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 11 months ago
To fix the problem, we need to ensure that the applicationName parameter cannot be used to modify the Object.prototype. This can be achieved by validating the applicationName to ensure it does not contain any special property names like __proto__, constructor, or prototype.
The best way to fix this without changing existing functionality is to add a validation check at the beginning of the setTaskNode method. If the applicationName is one of the restricted property names, we should 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]; |
963c635 to
b5c9e78
Compare
No description provided.