git-cli-scanner 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +9 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -673,9 +673,9 @@ init_logger();
|
|
|
673
673
|
|
|
674
674
|
// src/utils/prompts.ts
|
|
675
675
|
var import_prompts = require("@inquirer/prompts");
|
|
676
|
-
async function askToContinue() {
|
|
676
|
+
async function askToContinue(isHook) {
|
|
677
677
|
return await (0, import_prompts.confirm)({
|
|
678
|
-
message: "Vulnerabilities were found! Do you still want to continue with the commit?",
|
|
678
|
+
message: isHook ? "Vulnerabilities were found! Do you still want to continue with the commit?" : "Vulnerabilities were found! Do you want to ignore them?",
|
|
679
679
|
default: false
|
|
680
680
|
});
|
|
681
681
|
}
|
|
@@ -727,7 +727,7 @@ var Spinner = class {
|
|
|
727
727
|
var fs3 = __toESM(require("fs"));
|
|
728
728
|
var path3 = __toESM(require("path"));
|
|
729
729
|
var program = new import_commander.Command();
|
|
730
|
-
program.name("git-cli-scanner").description("Interactive Git hooks vulnerability scanner").version("1.1.
|
|
730
|
+
program.name("git-cli-scanner").description("Interactive Git hooks vulnerability scanner").version("1.1.5");
|
|
731
731
|
program.command("init").description("Install pre-commit hook for automatic scanning").action(() => {
|
|
732
732
|
info("Setting up pre-commit hook...");
|
|
733
733
|
try {
|
|
@@ -745,7 +745,7 @@ program.command("init").description("Install pre-commit hook for automatic scann
|
|
|
745
745
|
# git-cli-scanner pre-commit hook
|
|
746
746
|
# exec < /dev/tty is required to allow interactive prompts in git hooks
|
|
747
747
|
exec < /dev/tty
|
|
748
|
-
npx git-cli-scanner scan
|
|
748
|
+
npx git-cli-scanner scan --hook
|
|
749
749
|
`;
|
|
750
750
|
fs3.writeFileSync(hookPath, hookContent, { mode: 493 });
|
|
751
751
|
success("Pre-commit hook installed!");
|
|
@@ -776,7 +776,7 @@ program.command("disable").description("Remove the pre-commit hook and disable a
|
|
|
776
776
|
error(`Failed to disable: ${err.message}`);
|
|
777
777
|
}
|
|
778
778
|
});
|
|
779
|
-
program.command("scan").description("
|
|
779
|
+
program.command("scan").description("Scan staged files for vulnerabilities").option("--show-sol", "Show solutions for vulnerabilities").option("--hook", "Internal flag used when running as a git hook").action(async (options) => {
|
|
780
780
|
info("Git CLI Scanner running...");
|
|
781
781
|
try {
|
|
782
782
|
const spinner = new Spinner([
|
|
@@ -795,15 +795,15 @@ program.command("scan").description("Interactive vulnerability scan for staged f
|
|
|
795
795
|
const { printIssues: printIssues2 } = (init_logger(), __toCommonJS(logger_exports));
|
|
796
796
|
printIssues2(issues, options.showSol);
|
|
797
797
|
if (blockerIssues.length === 0) {
|
|
798
|
-
info("No high or medium vulnerabilities found. Safe to commit!");
|
|
798
|
+
info(options.hook ? "No high or medium vulnerabilities found. Safe to commit!" : "No high or medium vulnerabilities found.");
|
|
799
799
|
process.exit(0);
|
|
800
800
|
}
|
|
801
|
-
const shouldContinue = await askToContinue();
|
|
801
|
+
const shouldContinue = await askToContinue(!!options.hook);
|
|
802
802
|
if (shouldContinue) {
|
|
803
|
-
info("Proceeding with commit despite vulnerabilities.");
|
|
803
|
+
info(options.hook ? "Proceeding with commit despite vulnerabilities." : "Proceeding despite vulnerabilities.");
|
|
804
804
|
process.exit(0);
|
|
805
805
|
} else {
|
|
806
|
-
error("Commit aborted. Please edit your files and try again.");
|
|
806
|
+
error(options.hook ? "Commit aborted. Please edit your files and try again." : "Scan aborted. Please fix the issues.");
|
|
807
807
|
process.exit(1);
|
|
808
808
|
}
|
|
809
809
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-cli-scanner",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "A powerful interactive CLI tool that scans your codebase for hardcoded secrets, API keys, passwords, and private keys before they reach your Git history.",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"scripts": {
|