Skip to content

Commit

Permalink
fix potential vulnerability with git clone
Browse files Browse the repository at this point in the history
  • Loading branch information
yarkeev committed Apr 21, 2022
1 parent eef249d commit f828aa7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 4 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "git-interface",
"version": "2.1.1",
"version": "2.1.2",
"description": "some interfaces for work with git repository",
"main": "dist/index",
"typings": "dist/index",
Expand All @@ -9,7 +9,7 @@
"build": "npm run clean && npm run ts",
"dev": "npm run clean && ./node_modules/.bin/tsc -w",
"ts": "./node_modules/.bin/tsc",
"prepublish": "npm run build"
"prepublishOnly": "npm run build && bump"
},
"repository": {
"type": "git",
Expand All @@ -35,6 +35,7 @@
"homepage": "https://github.com/yarkeev/git-interface",
"devDependencies": {
"@types/node": "^10.10.3",
"typescript": "^3.0.3"
"typescript": "^3.0.3",
"version-bump-prompt": "^6.1.0"
}
}
8 changes: 3 additions & 5 deletions src/index.ts
Expand Up @@ -61,12 +61,10 @@ export class Git extends EventEmitter{
}

public clone(repository: string, dest: string, options?: { depth?: number}) {

const opt = options || { depth: Infinity }
const depthOption = opt.depth !== Infinity ? `--depth=${opt.depth}` : '';

const depthOption = opt.depth !== Infinity ? ` --depth=${opt.depth}` : '';

return this.gitExec(`clone ${repository} ${dest}${depthOption}`);
return this.gitExec(`clone ${depthOption} -- ${repository} ${dest}`);
}

public checkout(branchName: string) {
Expand Down Expand Up @@ -309,4 +307,4 @@ export class Git extends EventEmitter{
});
}

}
}

0 comments on commit f828aa7

Please sign in to comment.