agent-security-scanner-mcp 3.20.0 → 4.0.0
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/README.md +144 -43
- package/code-review-agent/.env.example +8 -0
- package/code-review-agent/README.md +142 -0
- package/code-review-agent/TODO.md +149 -0
- package/code-review-agent/bin/cr-agent.ts +313 -0
- package/code-review-agent/dist/bin/cr-agent.d.ts +3 -0
- package/code-review-agent/dist/bin/cr-agent.d.ts.map +1 -0
- package/code-review-agent/dist/bin/cr-agent.js +299 -0
- package/code-review-agent/dist/bin/cr-agent.js.map +1 -0
- package/code-review-agent/dist/src/analyzer/engine.d.ts +16 -0
- package/code-review-agent/dist/src/analyzer/engine.d.ts.map +1 -0
- package/code-review-agent/dist/src/analyzer/engine.js +298 -0
- package/code-review-agent/dist/src/analyzer/engine.js.map +1 -0
- package/code-review-agent/dist/src/analyzer/intent.d.ts +10 -0
- package/code-review-agent/dist/src/analyzer/intent.d.ts.map +1 -0
- package/code-review-agent/dist/src/analyzer/intent.js +40 -0
- package/code-review-agent/dist/src/analyzer/intent.js.map +1 -0
- package/code-review-agent/dist/src/analyzer/semantic.d.ts +19 -0
- package/code-review-agent/dist/src/analyzer/semantic.d.ts.map +1 -0
- package/code-review-agent/dist/src/analyzer/semantic.js +150 -0
- package/code-review-agent/dist/src/analyzer/semantic.js.map +1 -0
- package/code-review-agent/dist/src/context/assembler.d.ts +16 -0
- package/code-review-agent/dist/src/context/assembler.d.ts.map +1 -0
- package/code-review-agent/dist/src/context/assembler.js +135 -0
- package/code-review-agent/dist/src/context/assembler.js.map +1 -0
- package/code-review-agent/dist/src/context/file.d.ts +6 -0
- package/code-review-agent/dist/src/context/file.d.ts.map +1 -0
- package/code-review-agent/dist/src/context/file.js +139 -0
- package/code-review-agent/dist/src/context/file.js.map +1 -0
- package/code-review-agent/dist/src/context/project.d.ts +4 -0
- package/code-review-agent/dist/src/context/project.d.ts.map +1 -0
- package/code-review-agent/dist/src/context/project.js +252 -0
- package/code-review-agent/dist/src/context/project.js.map +1 -0
- package/code-review-agent/dist/src/graph/dependency.d.ts +11 -0
- package/code-review-agent/dist/src/graph/dependency.d.ts.map +1 -0
- package/code-review-agent/dist/src/graph/dependency.js +102 -0
- package/code-review-agent/dist/src/graph/dependency.js.map +1 -0
- package/code-review-agent/dist/src/graph/resolver.d.ts +9 -0
- package/code-review-agent/dist/src/graph/resolver.d.ts.map +1 -0
- package/code-review-agent/dist/src/graph/resolver.js +124 -0
- package/code-review-agent/dist/src/graph/resolver.js.map +1 -0
- package/code-review-agent/dist/src/index.d.ts +21 -0
- package/code-review-agent/dist/src/index.d.ts.map +1 -0
- package/code-review-agent/dist/src/index.js +21 -0
- package/code-review-agent/dist/src/index.js.map +1 -0
- package/code-review-agent/dist/src/llm/anthropic.d.ts +13 -0
- package/code-review-agent/dist/src/llm/anthropic.d.ts.map +1 -0
- package/code-review-agent/dist/src/llm/anthropic.js +83 -0
- package/code-review-agent/dist/src/llm/anthropic.js.map +1 -0
- package/code-review-agent/dist/src/llm/claude-cli.d.ts +13 -0
- package/code-review-agent/dist/src/llm/claude-cli.d.ts.map +1 -0
- package/code-review-agent/dist/src/llm/claude-cli.js +142 -0
- package/code-review-agent/dist/src/llm/claude-cli.js.map +1 -0
- package/code-review-agent/dist/src/llm/openai.d.ts +13 -0
- package/code-review-agent/dist/src/llm/openai.d.ts.map +1 -0
- package/code-review-agent/dist/src/llm/openai.js +78 -0
- package/code-review-agent/dist/src/llm/openai.js.map +1 -0
- package/code-review-agent/dist/src/llm/provider.d.ts +18 -0
- package/code-review-agent/dist/src/llm/provider.d.ts.map +1 -0
- package/code-review-agent/dist/src/llm/provider.js +11 -0
- package/code-review-agent/dist/src/llm/provider.js.map +1 -0
- package/code-review-agent/dist/src/llm/router.d.ts +14 -0
- package/code-review-agent/dist/src/llm/router.d.ts.map +1 -0
- package/code-review-agent/dist/src/llm/router.js +67 -0
- package/code-review-agent/dist/src/llm/router.js.map +1 -0
- package/code-review-agent/dist/src/llm/schemas.d.ts +18 -0
- package/code-review-agent/dist/src/llm/schemas.d.ts.map +1 -0
- package/code-review-agent/dist/src/llm/schemas.js +91 -0
- package/code-review-agent/dist/src/llm/schemas.js.map +1 -0
- package/code-review-agent/dist/src/types/analysis.d.ts +56 -0
- package/code-review-agent/dist/src/types/analysis.d.ts.map +1 -0
- package/code-review-agent/dist/src/types/analysis.js +2 -0
- package/code-review-agent/dist/src/types/analysis.js.map +1 -0
- package/code-review-agent/dist/src/types/config.d.ts +24 -0
- package/code-review-agent/dist/src/types/config.d.ts.map +1 -0
- package/code-review-agent/dist/src/types/config.js +42 -0
- package/code-review-agent/dist/src/types/config.js.map +1 -0
- package/code-review-agent/dist/src/types/findings.d.ts +236 -0
- package/code-review-agent/dist/src/types/findings.d.ts.map +1 -0
- package/code-review-agent/dist/src/types/findings.js +64 -0
- package/code-review-agent/dist/src/types/findings.js.map +1 -0
- package/code-review-agent/package.json +36 -0
- package/code-review-agent/src/analyzer/engine.ts +374 -0
- package/code-review-agent/src/analyzer/intent.ts +49 -0
- package/code-review-agent/src/analyzer/semantic.ts +222 -0
- package/code-review-agent/src/context/assembler.ts +165 -0
- package/code-review-agent/src/context/file.ts +145 -0
- package/code-review-agent/src/context/project.ts +253 -0
- package/code-review-agent/src/graph/dependency.ts +116 -0
- package/code-review-agent/src/graph/resolver.ts +138 -0
- package/code-review-agent/src/index.ts +58 -0
- package/code-review-agent/src/llm/anthropic.ts +106 -0
- package/code-review-agent/src/llm/claude-cli.ts +188 -0
- package/code-review-agent/src/llm/openai.ts +95 -0
- package/code-review-agent/src/llm/provider.ts +33 -0
- package/code-review-agent/src/llm/router.ts +86 -0
- package/code-review-agent/src/llm/schemas.ts +125 -0
- package/code-review-agent/src/types/analysis.ts +62 -0
- package/code-review-agent/src/types/config.ts +72 -0
- package/code-review-agent/src/types/findings.ts +81 -0
- package/code-review-agent/tests/analyzer/engine.test.ts +194 -0
- package/code-review-agent/tests/analyzer/intent.test.ts +76 -0
- package/code-review-agent/tests/analyzer/semantic.test.ts +131 -0
- package/code-review-agent/tests/context/file.test.ts +21 -0
- package/code-review-agent/tests/context/project.test.ts +20 -0
- package/code-review-agent/tests/fixtures/safe-build-tool/README.md +19 -0
- package/code-review-agent/tests/fixtures/safe-build-tool/builder.js +52 -0
- package/code-review-agent/tests/fixtures/safe-file-manager/README.md +16 -0
- package/code-review-agent/tests/fixtures/safe-file-manager/organizer.py +70 -0
- package/code-review-agent/tests/fixtures/vuln-api-server/README.md +17 -0
- package/code-review-agent/tests/fixtures/vuln-api-server/server.js +52 -0
- package/code-review-agent/tests/fixtures/vuln-ecommerce/README.md +18 -0
- package/code-review-agent/tests/fixtures/vuln-ecommerce/checkout.js +63 -0
- package/code-review-agent/tests/graph/dependency.test.ts +136 -0
- package/code-review-agent/tests/helpers/mock-provider.ts +48 -0
- package/code-review-agent/tests/llm/claude-cli.test.ts +251 -0
- package/code-review-agent/tests/llm/router.test.ts +77 -0
- package/code-review-agent/tests/llm/schemas.test.ts +142 -0
- package/code-review-agent/tsconfig.json +20 -0
- package/code-review-agent/vitest.config.ts +11 -0
- package/index.js +18 -18
- package/openclaw.plugin.json +2 -2
- package/package.json +13 -3
- package/server.json +3 -3
- package/src/cli/init-hooks.js +3 -3
- package/src/cli/init.js +1 -1
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SeveritySchema: z.ZodEnum<["critical", "high", "medium", "low", "info"]>;
|
|
3
|
+
export type Severity = z.infer<typeof SeveritySchema>;
|
|
4
|
+
export declare const CategorySchema: z.ZodEnum<["logic-bug", "security", "race-condition", "null-ref", "boundary", "type-error", "unhandled-exception", "other"]>;
|
|
5
|
+
export type Category = z.infer<typeof CategorySchema>;
|
|
6
|
+
export declare const IntentAlignmentSchema: z.ZodEnum<["violates-intent", "matches-intent", "unclear"]>;
|
|
7
|
+
export type IntentAlignment = z.infer<typeof IntentAlignmentSchema>;
|
|
8
|
+
export declare const RiskDomainSchema: z.ZodEnum<["web-api", "cli-tool", "library", "build-tool", "data-pipeline", "desktop-app", "unknown"]>;
|
|
9
|
+
export type RiskDomain = z.infer<typeof RiskDomainSchema>;
|
|
10
|
+
export declare const LocationSchema: z.ZodObject<{
|
|
11
|
+
file: z.ZodString;
|
|
12
|
+
startLine: z.ZodNumber;
|
|
13
|
+
endLine: z.ZodNumber;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
file: string;
|
|
16
|
+
startLine: number;
|
|
17
|
+
endLine: number;
|
|
18
|
+
}, {
|
|
19
|
+
file: string;
|
|
20
|
+
startLine: number;
|
|
21
|
+
endLine: number;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const FindingSchema: z.ZodObject<{
|
|
24
|
+
title: z.ZodString;
|
|
25
|
+
severity: z.ZodEnum<["critical", "high", "medium", "low", "info"]>;
|
|
26
|
+
category: z.ZodEnum<["logic-bug", "security", "race-condition", "null-ref", "boundary", "type-error", "unhandled-exception", "other"]>;
|
|
27
|
+
location: z.ZodObject<{
|
|
28
|
+
file: z.ZodString;
|
|
29
|
+
startLine: z.ZodNumber;
|
|
30
|
+
endLine: z.ZodNumber;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
file: string;
|
|
33
|
+
startLine: number;
|
|
34
|
+
endLine: number;
|
|
35
|
+
}, {
|
|
36
|
+
file: string;
|
|
37
|
+
startLine: number;
|
|
38
|
+
endLine: number;
|
|
39
|
+
}>;
|
|
40
|
+
reasoning: z.ZodString;
|
|
41
|
+
intentAlignment: z.ZodEnum<["violates-intent", "matches-intent", "unclear"]>;
|
|
42
|
+
confidence: z.ZodNumber;
|
|
43
|
+
suggestedAction: z.ZodString;
|
|
44
|
+
cwe: z.ZodOptional<z.ZodString>;
|
|
45
|
+
owasp: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
title: string;
|
|
48
|
+
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
49
|
+
category: "logic-bug" | "security" | "race-condition" | "null-ref" | "boundary" | "type-error" | "unhandled-exception" | "other";
|
|
50
|
+
location: {
|
|
51
|
+
file: string;
|
|
52
|
+
startLine: number;
|
|
53
|
+
endLine: number;
|
|
54
|
+
};
|
|
55
|
+
reasoning: string;
|
|
56
|
+
intentAlignment: "violates-intent" | "matches-intent" | "unclear";
|
|
57
|
+
confidence: number;
|
|
58
|
+
suggestedAction: string;
|
|
59
|
+
cwe?: string | undefined;
|
|
60
|
+
owasp?: string | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
title: string;
|
|
63
|
+
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
64
|
+
category: "logic-bug" | "security" | "race-condition" | "null-ref" | "boundary" | "type-error" | "unhandled-exception" | "other";
|
|
65
|
+
location: {
|
|
66
|
+
file: string;
|
|
67
|
+
startLine: number;
|
|
68
|
+
endLine: number;
|
|
69
|
+
};
|
|
70
|
+
reasoning: string;
|
|
71
|
+
intentAlignment: "violates-intent" | "matches-intent" | "unclear";
|
|
72
|
+
confidence: number;
|
|
73
|
+
suggestedAction: string;
|
|
74
|
+
cwe?: string | undefined;
|
|
75
|
+
owasp?: string | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
export type Finding = z.infer<typeof FindingSchema>;
|
|
78
|
+
export declare const FileAnalysisResponseSchema: z.ZodObject<{
|
|
79
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
80
|
+
title: z.ZodString;
|
|
81
|
+
severity: z.ZodEnum<["critical", "high", "medium", "low", "info"]>;
|
|
82
|
+
category: z.ZodEnum<["logic-bug", "security", "race-condition", "null-ref", "boundary", "type-error", "unhandled-exception", "other"]>;
|
|
83
|
+
location: z.ZodObject<{
|
|
84
|
+
file: z.ZodString;
|
|
85
|
+
startLine: z.ZodNumber;
|
|
86
|
+
endLine: z.ZodNumber;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
file: string;
|
|
89
|
+
startLine: number;
|
|
90
|
+
endLine: number;
|
|
91
|
+
}, {
|
|
92
|
+
file: string;
|
|
93
|
+
startLine: number;
|
|
94
|
+
endLine: number;
|
|
95
|
+
}>;
|
|
96
|
+
reasoning: z.ZodString;
|
|
97
|
+
intentAlignment: z.ZodEnum<["violates-intent", "matches-intent", "unclear"]>;
|
|
98
|
+
confidence: z.ZodNumber;
|
|
99
|
+
suggestedAction: z.ZodString;
|
|
100
|
+
cwe: z.ZodOptional<z.ZodString>;
|
|
101
|
+
owasp: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
title: string;
|
|
104
|
+
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
105
|
+
category: "logic-bug" | "security" | "race-condition" | "null-ref" | "boundary" | "type-error" | "unhandled-exception" | "other";
|
|
106
|
+
location: {
|
|
107
|
+
file: string;
|
|
108
|
+
startLine: number;
|
|
109
|
+
endLine: number;
|
|
110
|
+
};
|
|
111
|
+
reasoning: string;
|
|
112
|
+
intentAlignment: "violates-intent" | "matches-intent" | "unclear";
|
|
113
|
+
confidence: number;
|
|
114
|
+
suggestedAction: string;
|
|
115
|
+
cwe?: string | undefined;
|
|
116
|
+
owasp?: string | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
title: string;
|
|
119
|
+
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
120
|
+
category: "logic-bug" | "security" | "race-condition" | "null-ref" | "boundary" | "type-error" | "unhandled-exception" | "other";
|
|
121
|
+
location: {
|
|
122
|
+
file: string;
|
|
123
|
+
startLine: number;
|
|
124
|
+
endLine: number;
|
|
125
|
+
};
|
|
126
|
+
reasoning: string;
|
|
127
|
+
intentAlignment: "violates-intent" | "matches-intent" | "unclear";
|
|
128
|
+
confidence: number;
|
|
129
|
+
suggestedAction: string;
|
|
130
|
+
cwe?: string | undefined;
|
|
131
|
+
owasp?: string | undefined;
|
|
132
|
+
}>, "many">;
|
|
133
|
+
}, "strip", z.ZodTypeAny, {
|
|
134
|
+
findings: {
|
|
135
|
+
title: string;
|
|
136
|
+
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
137
|
+
category: "logic-bug" | "security" | "race-condition" | "null-ref" | "boundary" | "type-error" | "unhandled-exception" | "other";
|
|
138
|
+
location: {
|
|
139
|
+
file: string;
|
|
140
|
+
startLine: number;
|
|
141
|
+
endLine: number;
|
|
142
|
+
};
|
|
143
|
+
reasoning: string;
|
|
144
|
+
intentAlignment: "violates-intent" | "matches-intent" | "unclear";
|
|
145
|
+
confidence: number;
|
|
146
|
+
suggestedAction: string;
|
|
147
|
+
cwe?: string | undefined;
|
|
148
|
+
owasp?: string | undefined;
|
|
149
|
+
}[];
|
|
150
|
+
}, {
|
|
151
|
+
findings: {
|
|
152
|
+
title: string;
|
|
153
|
+
severity: "critical" | "high" | "medium" | "low" | "info";
|
|
154
|
+
category: "logic-bug" | "security" | "race-condition" | "null-ref" | "boundary" | "type-error" | "unhandled-exception" | "other";
|
|
155
|
+
location: {
|
|
156
|
+
file: string;
|
|
157
|
+
startLine: number;
|
|
158
|
+
endLine: number;
|
|
159
|
+
};
|
|
160
|
+
reasoning: string;
|
|
161
|
+
intentAlignment: "violates-intent" | "matches-intent" | "unclear";
|
|
162
|
+
confidence: number;
|
|
163
|
+
suggestedAction: string;
|
|
164
|
+
cwe?: string | undefined;
|
|
165
|
+
owasp?: string | undefined;
|
|
166
|
+
}[];
|
|
167
|
+
}>;
|
|
168
|
+
export type FileAnalysisResponse = z.infer<typeof FileAnalysisResponseSchema>;
|
|
169
|
+
export declare const IntentProfileSchema: z.ZodObject<{
|
|
170
|
+
purpose: z.ZodString;
|
|
171
|
+
expectedBehaviors: z.ZodArray<z.ZodString, "many">;
|
|
172
|
+
unexpectedBehaviors: z.ZodArray<z.ZodString, "many">;
|
|
173
|
+
framework: z.ZodString;
|
|
174
|
+
riskDomain: z.ZodEnum<["web-api", "cli-tool", "library", "build-tool", "data-pipeline", "desktop-app", "unknown"]>;
|
|
175
|
+
}, "strip", z.ZodTypeAny, {
|
|
176
|
+
purpose: string;
|
|
177
|
+
expectedBehaviors: string[];
|
|
178
|
+
unexpectedBehaviors: string[];
|
|
179
|
+
framework: string;
|
|
180
|
+
riskDomain: "web-api" | "cli-tool" | "library" | "build-tool" | "data-pipeline" | "desktop-app" | "unknown";
|
|
181
|
+
}, {
|
|
182
|
+
purpose: string;
|
|
183
|
+
expectedBehaviors: string[];
|
|
184
|
+
unexpectedBehaviors: string[];
|
|
185
|
+
framework: string;
|
|
186
|
+
riskDomain: "web-api" | "cli-tool" | "library" | "build-tool" | "data-pipeline" | "desktop-app" | "unknown";
|
|
187
|
+
}>;
|
|
188
|
+
export type IntentProfile = z.infer<typeof IntentProfileSchema>;
|
|
189
|
+
export declare const AreaOfInterestSchema: z.ZodObject<{
|
|
190
|
+
startLine: z.ZodNumber;
|
|
191
|
+
endLine: z.ZodNumber;
|
|
192
|
+
reason: z.ZodString;
|
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
|
194
|
+
startLine: number;
|
|
195
|
+
endLine: number;
|
|
196
|
+
reason: string;
|
|
197
|
+
}, {
|
|
198
|
+
startLine: number;
|
|
199
|
+
endLine: number;
|
|
200
|
+
reason: string;
|
|
201
|
+
}>;
|
|
202
|
+
export declare const TriageDecisionSchema: z.ZodObject<{
|
|
203
|
+
action: z.ZodEnum<["analyze", "skip"]>;
|
|
204
|
+
reason: z.ZodString;
|
|
205
|
+
areasOfInterest: z.ZodArray<z.ZodObject<{
|
|
206
|
+
startLine: z.ZodNumber;
|
|
207
|
+
endLine: z.ZodNumber;
|
|
208
|
+
reason: z.ZodString;
|
|
209
|
+
}, "strip", z.ZodTypeAny, {
|
|
210
|
+
startLine: number;
|
|
211
|
+
endLine: number;
|
|
212
|
+
reason: string;
|
|
213
|
+
}, {
|
|
214
|
+
startLine: number;
|
|
215
|
+
endLine: number;
|
|
216
|
+
reason: string;
|
|
217
|
+
}>, "many">;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
reason: string;
|
|
220
|
+
action: "analyze" | "skip";
|
|
221
|
+
areasOfInterest: {
|
|
222
|
+
startLine: number;
|
|
223
|
+
endLine: number;
|
|
224
|
+
reason: string;
|
|
225
|
+
}[];
|
|
226
|
+
}, {
|
|
227
|
+
reason: string;
|
|
228
|
+
action: "analyze" | "skip";
|
|
229
|
+
areasOfInterest: {
|
|
230
|
+
startLine: number;
|
|
231
|
+
endLine: number;
|
|
232
|
+
reason: string;
|
|
233
|
+
}[];
|
|
234
|
+
}>;
|
|
235
|
+
export type TriageDecision = z.infer<typeof TriageDecisionSchema>;
|
|
236
|
+
//# sourceMappingURL=findings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.d.ts","sourceRoot":"","sources":["../../../src/types/findings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc,0DAAwD,CAAC;AACpF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,cAAc,8HASzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,qBAAqB,6DAIhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,gBAAgB,wGAQ3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;;;EAIzB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAErC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAM9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const SeveritySchema = z.enum(['critical', 'high', 'medium', 'low', 'info']);
|
|
3
|
+
export const CategorySchema = z.enum([
|
|
4
|
+
'logic-bug',
|
|
5
|
+
'security',
|
|
6
|
+
'race-condition',
|
|
7
|
+
'null-ref',
|
|
8
|
+
'boundary',
|
|
9
|
+
'type-error',
|
|
10
|
+
'unhandled-exception',
|
|
11
|
+
'other',
|
|
12
|
+
]);
|
|
13
|
+
export const IntentAlignmentSchema = z.enum([
|
|
14
|
+
'violates-intent',
|
|
15
|
+
'matches-intent',
|
|
16
|
+
'unclear',
|
|
17
|
+
]);
|
|
18
|
+
export const RiskDomainSchema = z.enum([
|
|
19
|
+
'web-api',
|
|
20
|
+
'cli-tool',
|
|
21
|
+
'library',
|
|
22
|
+
'build-tool',
|
|
23
|
+
'data-pipeline',
|
|
24
|
+
'desktop-app',
|
|
25
|
+
'unknown',
|
|
26
|
+
]);
|
|
27
|
+
export const LocationSchema = z.object({
|
|
28
|
+
file: z.string(),
|
|
29
|
+
startLine: z.number().int().min(1),
|
|
30
|
+
endLine: z.number().int().min(1),
|
|
31
|
+
});
|
|
32
|
+
export const FindingSchema = z.object({
|
|
33
|
+
title: z.string(),
|
|
34
|
+
severity: SeveritySchema,
|
|
35
|
+
category: CategorySchema,
|
|
36
|
+
location: LocationSchema,
|
|
37
|
+
reasoning: z.string(),
|
|
38
|
+
intentAlignment: IntentAlignmentSchema,
|
|
39
|
+
confidence: z.number().min(0).max(1),
|
|
40
|
+
suggestedAction: z.string(),
|
|
41
|
+
cwe: z.string().optional(),
|
|
42
|
+
owasp: z.string().optional(),
|
|
43
|
+
});
|
|
44
|
+
export const FileAnalysisResponseSchema = z.object({
|
|
45
|
+
findings: z.array(FindingSchema),
|
|
46
|
+
});
|
|
47
|
+
export const IntentProfileSchema = z.object({
|
|
48
|
+
purpose: z.string(),
|
|
49
|
+
expectedBehaviors: z.array(z.string()),
|
|
50
|
+
unexpectedBehaviors: z.array(z.string()),
|
|
51
|
+
framework: z.string(),
|
|
52
|
+
riskDomain: RiskDomainSchema,
|
|
53
|
+
});
|
|
54
|
+
export const AreaOfInterestSchema = z.object({
|
|
55
|
+
startLine: z.number(),
|
|
56
|
+
endLine: z.number(),
|
|
57
|
+
reason: z.string(),
|
|
58
|
+
});
|
|
59
|
+
export const TriageDecisionSchema = z.object({
|
|
60
|
+
action: z.enum(['analyze', 'skip']),
|
|
61
|
+
reason: z.string(),
|
|
62
|
+
areasOfInterest: z.array(AreaOfInterestSchema),
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=findings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.js","sourceRoot":"","sources":["../../../src/types/findings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAA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rules-based scanning",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"cr-agent": "dist/bin/cr-agent.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"dev": "tsx bin/cr-agent.ts",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"lint": "tsc --noEmit"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18.0.0"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@anthropic-ai/sdk": "^0.39.0",
|
|
23
|
+
"@anthropic-ai/tokenizer": "^0.0.4",
|
|
24
|
+
"chalk": "^5.4.1",
|
|
25
|
+
"commander": "^13.1.0",
|
|
26
|
+
"openai": "^4.85.0",
|
|
27
|
+
"tiktoken": "^1.0.18",
|
|
28
|
+
"zod": "^3.24.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.13.0",
|
|
32
|
+
"tsx": "^4.19.0",
|
|
33
|
+
"typescript": "^5.7.3",
|
|
34
|
+
"vitest": "^3.0.5"
|
|
35
|
+
}
|
|
36
|
+
}
|