@offgridsec/kira-lite-mcp 0.2.1 → 0.2.2
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/INSTALL.md +6 -6
- package/README.md +4 -4
- package/config/settings.local.json +1 -1
- package/dist/config.js +1 -1
- package/dist/core/engines/osv.js +1 -1
- package/dist/core/engines/runner.js +1 -1
- package/dist/core/scanner.js +1 -1
- package/dist/core/utils.js +1 -1
- package/dist/index.js +1 -1
- package/dist/rules/c-cpp.js +1 -1
- package/dist/rules/cicd.js +1 -1
- package/dist/rules/csharp-extended.js +1 -1
- package/dist/rules/csharp.js +1 -1
- package/dist/rules/docker.js +1 -1
- package/dist/rules/go-extended.js +1 -1
- package/dist/rules/go.js +1 -1
- package/dist/rules/graphql-extended.js +1 -1
- package/dist/rules/index.js +1 -1
- package/dist/rules/java-extended.js +1 -1
- package/dist/rules/java.js +1 -1
- package/dist/rules/javascript-extended.js +1 -1
- package/dist/rules/javascript.js +1 -1
- package/dist/rules/kotlin.js +1 -1
- package/dist/rules/kubernetes.js +1 -1
- package/dist/rules/php-extended.js +1 -1
- package/dist/rules/php.js +1 -1
- package/dist/rules/python-extended.js +1 -1
- package/dist/rules/python.js +1 -1
- package/dist/rules/ruby-extended.js +1 -1
- package/dist/rules/ruby.js +1 -1
- package/dist/rules/rust.js +1 -1
- package/dist/rules/secrets-extended.js +1 -1
- package/dist/rules/secrets.js +1 -1
- package/dist/rules/shell.js +1 -1
- package/dist/rules/swift.js +1 -1
- package/dist/rules/terraform.js +1 -1
- package/dist/telemetry.js +1 -1
- package/dist/tools/fix-vulnerability.js +1 -1
- package/dist/tools/scan-code.js +1 -1
- package/dist/tools/scan-dependencies.js +1 -1
- package/dist/tools/scan-diff.js +1 -1
- package/dist/tools/scan-file.js +1 -1
- package/dist/tools/scan-new-imports.js +1 -1
- package/hook.mjs +17 -25
- package/package.json +1 -1
package/hook.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// Kira-Lite
|
|
4
|
-
//
|
|
5
|
-
// Falls back to report-only mode when running under PostToolUse (legacy installs).
|
|
3
|
+
// Kira-Lite post-write hook for Claude Code
|
|
4
|
+
// Scans files after Edit/Write to catch anything the MCP pre-scan missed.
|
|
6
5
|
|
|
7
6
|
import { KiraScanner } from "./dist/core/scanner.js";
|
|
8
7
|
import { readFileSync } from "node:fs";
|
|
@@ -29,26 +28,21 @@ process.stdin.on("data", (chunk) => (input += chunk));
|
|
|
29
28
|
process.stdin.on("end", async () => {
|
|
30
29
|
try {
|
|
31
30
|
const hookData = JSON.parse(input);
|
|
32
|
-
const
|
|
33
|
-
const toolInput = hookData?.tool_input;
|
|
34
|
-
const filePath = toolInput?.file_path;
|
|
35
|
-
const isPreHook = hookData?.hook_event_name === "PreToolUse";
|
|
31
|
+
const filePath = hookData?.tool_input?.file_path;
|
|
36
32
|
|
|
37
|
-
if (!
|
|
33
|
+
if (!filePath) process.exit(0);
|
|
38
34
|
|
|
39
|
-
//
|
|
40
|
-
let code
|
|
41
|
-
|
|
42
|
-
code =
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
} else if (toolName === "MultiEdit") {
|
|
46
|
-
code = (toolInput?.edits || []).map((e) => e.new_string).join("\n");
|
|
35
|
+
// Read the file that was just written
|
|
36
|
+
let code;
|
|
37
|
+
try {
|
|
38
|
+
code = readFileSync(filePath, "utf-8");
|
|
39
|
+
} catch {
|
|
40
|
+
process.exit(0); // file doesn't exist or can't read — skip
|
|
47
41
|
}
|
|
48
42
|
|
|
49
|
-
if (!code || !filePath) process.exit(0);
|
|
50
|
-
|
|
51
43
|
const language = detectLanguage(filePath);
|
|
44
|
+
|
|
45
|
+
// Use regex-only scan for speed (hooks should be fast)
|
|
52
46
|
const result = scanner.scanRegex({ code, language, filename: filePath });
|
|
53
47
|
|
|
54
48
|
const critical = result.findings.filter(
|
|
@@ -56,16 +50,14 @@ process.stdin.on("end", async () => {
|
|
|
56
50
|
);
|
|
57
51
|
|
|
58
52
|
if (critical.length > 0) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
`\n⚠ Kira-Lite ${action}: ${critical.length} critical/high vulnerabilities in ${filePath}:\n`
|
|
53
|
+
console.error(
|
|
54
|
+
`\n⚠ Kira-Lite: ${critical.length} critical/high vulnerabilities in ${filePath}:`
|
|
62
55
|
);
|
|
63
56
|
for (const f of critical) {
|
|
64
|
-
|
|
57
|
+
console.error(` [${f.severity.toUpperCase()}] ${f.title} (line ${f.line})`);
|
|
65
58
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
process.exit(isPreHook ? 2 : 0);
|
|
59
|
+
console.error("");
|
|
60
|
+
process.exit(1);
|
|
69
61
|
}
|
|
70
62
|
|
|
71
63
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@offgridsec/kira-lite-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Kira-Lite MCP Server — Real-time security scanning for AI coding assistants",
|
|
5
5
|
"author": "Offgrid Security <contact@offgridsec.com>",
|
|
6
6
|
"homepage": "https://offgridsec.com",
|