-
Notifications
You must be signed in to change notification settings - Fork 357
feat: snapi #6062
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
base: main
Are you sure you want to change the base?
feat: snapi #6062
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
async checkoutBranch(branch: string): Promise<void> { | ||
try { | ||
execSync(`git checkout ${branch}`, { |
Check warning
Code scanning / CodeQL
Unsafe shell command constructed from library input Medium
library input
shell command
|
||
async getLastCommit(branch: string): Promise<string> { | ||
try { | ||
const commit = execSync(`git rev-parse ${branch}`, { |
Check warning
Code scanning / CodeQL
Unsafe shell command constructed from library input Medium
library input
shell command
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 17 days ago
To fix the issue, we will replace the use of execSync
with string interpolation by using a safer API, execFileSync
, which allows passing arguments as an array. This approach avoids shell interpretation of special characters in the input. Specifically:
- Replace the
execSync
call on line 34 withexecFileSync
, passingbranch
as an argument in an array. - Ensure that the
branch
parameter is passed as-is without being interpolated into a shell command string.
No additional dependencies are required for this fix.
-
Copy modified line R34
@@ -33,3 +33,3 @@ | ||
try { | ||
const commit = execSync(`git rev-parse ${branch}`, { | ||
const commit = execSync('git', ['rev-parse', branch], { | ||
cwd: this.workspaceRoot, |
|
||
async fetchBranch(branch: string): Promise<void> { | ||
try { | ||
execSync(`git fetch origin ${branch}`, { |
Check warning
Code scanning / CodeQL
Unsafe shell command constructed from library input Medium
library input
shell command
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 17 days ago
To fix the issue, we will replace the use of execSync
with a safer alternative. Specifically, we will use child_process.execFileSync
, which allows us to pass arguments as an array, avoiding the need for shell interpretation. This approach ensures that special characters in the branch
parameter are treated as literal strings rather than being interpreted by the shell.
The changes will involve:
- Replacing the string interpolation in the
execSync
call with anexecFileSync
call. - Passing the
branch
parameter as an argument in an array toexecFileSync
.
-
Copy modified line R1 -
Copy modified line R92
@@ -1,2 +1,2 @@ | ||
import { execSync } from 'child_process'; | ||
import { execSync, execFileSync } from 'child_process'; | ||
|
||
@@ -91,3 +91,3 @@ | ||
try { | ||
execSync(`git fetch origin ${branch}`, { | ||
execFileSync('git', ['fetch', 'origin', branch], { | ||
cwd: this.workspaceRoot, |
🔍 API Changes Report✅ No API ChangesSummary✅ No API changes detected in any packages. All public APIs remain stable and backward compatible. Next Steps✅ No API changes detected. Safe to merge. This report was generated by the API Breakage Detector. For more information, see the documentation. 🤖 This comment was automatically generated by the API Breakage Detector |
Description
Fixes: SDKI-954
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change