@jigyasudham/veto 0.8.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/.claude/settings.local.json +9 -0
- package/README.md +190 -0
- package/dist/adapters/claude.js +57 -0
- package/dist/adapters/codex.js +58 -0
- package/dist/adapters/gemini.js +58 -0
- package/dist/adapters/index.js +156 -0
- package/dist/agents/development/api.js +116 -0
- package/dist/agents/development/backend.js +82 -0
- package/dist/agents/development/coder.js +207 -0
- package/dist/agents/development/database.js +81 -0
- package/dist/agents/development/debugger.js +234 -0
- package/dist/agents/development/devops.js +84 -0
- package/dist/agents/development/frontend.js +83 -0
- package/dist/agents/development/migration.js +141 -0
- package/dist/agents/development/performance.js +142 -0
- package/dist/agents/development/refactor.js +85 -0
- package/dist/agents/development/reviewer.js +260 -0
- package/dist/agents/development/tester.js +143 -0
- package/dist/agents/executor.js +144 -0
- package/dist/agents/memory/context-manager.js +167 -0
- package/dist/agents/memory/decision-logger.js +157 -0
- package/dist/agents/memory/knowledge-base.js +120 -0
- package/dist/agents/memory/pattern-learner.js +140 -0
- package/dist/agents/memory/project-mapper.js +114 -0
- package/dist/agents/quality/accessibility.js +89 -0
- package/dist/agents/quality/code-quality.js +109 -0
- package/dist/agents/quality/compatibility.js +55 -0
- package/dist/agents/quality/documentation.js +95 -0
- package/dist/agents/quality/error-handling.js +87 -0
- package/dist/agents/research/competitor-analyzer.js +44 -0
- package/dist/agents/research/cost-analyzer.js +51 -0
- package/dist/agents/research/estimator.js +57 -0
- package/dist/agents/research/ethics-bias.js +111 -0
- package/dist/agents/research/researcher.js +112 -0
- package/dist/agents/research/risk-assessor.js +61 -0
- package/dist/agents/research/tech-advisor.js +52 -0
- package/dist/agents/security/auth.js +269 -0
- package/dist/agents/security/dependency-audit.js +273 -0
- package/dist/agents/security/penetration.js +245 -0
- package/dist/agents/security/privacy.js +259 -0
- package/dist/agents/security/scanner.js +288 -0
- package/dist/agents/security/secrets.js +212 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/workflow/automation.js +56 -0
- package/dist/agents/workflow/file-manager.js +49 -0
- package/dist/agents/workflow/git-agent.js +52 -0
- package/dist/agents/workflow/reporter.js +48 -0
- package/dist/agents/workflow/search-agent.js +39 -0
- package/dist/agents/workflow/task-coordinator.js +40 -0
- package/dist/agents/workflow/task-planner.js +46 -0
- package/dist/cli.js +132 -0
- package/dist/council/decision-engine.js +136 -0
- package/dist/council/devil-advocate.js +106 -0
- package/dist/council/index.js +37 -0
- package/dist/council/lead-developer.js +108 -0
- package/dist/council/legal-compliance.js +142 -0
- package/dist/council/product-manager.js +92 -0
- package/dist/council/security.js +162 -0
- package/dist/council/system-architect.js +122 -0
- package/dist/council/types.js +2 -0
- package/dist/council/ux-designer.js +109 -0
- package/dist/memory/local.js +182 -0
- package/dist/memory/schema.js +116 -0
- package/dist/memory/sync.js +199 -0
- package/dist/router/complexity-scorer.js +78 -0
- package/dist/router/context-compressor.js +58 -0
- package/dist/router/index.js +29 -0
- package/dist/router/learning-updater.js +186 -0
- package/dist/router/model-selector.js +51 -0
- package/dist/router/rate-monitor.js +73 -0
- package/dist/server.js +949 -0
- package/dist/skills/development/skill-api-design.js +313 -0
- package/dist/skills/development/skill-auth.js +255 -0
- package/dist/skills/development/skill-ci-cd.js +2 -0
- package/dist/skills/development/skill-crud.js +193 -0
- package/dist/skills/development/skill-db-schema.js +2 -0
- package/dist/skills/development/skill-docker.js +2 -0
- package/dist/skills/development/skill-env-setup.js +2 -0
- package/dist/skills/development/skill-scaffold.js +299 -0
- package/dist/skills/intelligence/skill-complexity-score.js +66 -0
- package/dist/skills/intelligence/skill-cost-track.js +36 -0
- package/dist/skills/intelligence/skill-learning-loop.js +66 -0
- package/dist/skills/intelligence/skill-pattern-detect.js +35 -0
- package/dist/skills/intelligence/skill-rate-watch.js +58 -0
- package/dist/skills/memory/skill-context-compress.js +82 -0
- package/dist/skills/memory/skill-cross-sync.js +88 -0
- package/dist/skills/memory/skill-decision-log.js +103 -0
- package/dist/skills/memory/skill-session-restore.js +44 -0
- package/dist/skills/memory/skill-session-save.js +78 -0
- package/dist/skills/quality/skill-accessibility.js +2 -0
- package/dist/skills/quality/skill-code-review.js +60 -0
- package/dist/skills/quality/skill-docs-gen.js +2 -0
- package/dist/skills/quality/skill-perf-audit.js +2 -0
- package/dist/skills/quality/skill-security-scan.js +67 -0
- package/dist/skills/quality/skill-test-suite.js +274 -0
- package/dist/skills/workflow/skill-deploy.js +2 -0
- package/dist/skills/workflow/skill-git-workflow.js +2 -0
- package/dist/skills/workflow/skill-rollback.js +2 -0
- package/dist/skills/workflow/skill-task-breakdown.js +2 -0
- package/package.json +30 -0
- package/src/adapters/claude.ts +70 -0
- package/src/adapters/codex.ts +71 -0
- package/src/adapters/gemini.ts +71 -0
- package/src/adapters/index.ts +217 -0
- package/src/agents/development/api.ts +120 -0
- package/src/agents/development/backend.ts +85 -0
- package/src/agents/development/coder.ts +213 -0
- package/src/agents/development/database.ts +83 -0
- package/src/agents/development/debugger.ts +238 -0
- package/src/agents/development/devops.ts +86 -0
- package/src/agents/development/frontend.ts +85 -0
- package/src/agents/development/migration.ts +144 -0
- package/src/agents/development/performance.ts +144 -0
- package/src/agents/development/refactor.ts +86 -0
- package/src/agents/development/reviewer.ts +268 -0
- package/src/agents/development/tester.ts +151 -0
- package/src/agents/executor.ts +158 -0
- package/src/agents/memory/context-manager.ts +171 -0
- package/src/agents/memory/decision-logger.ts +160 -0
- package/src/agents/memory/knowledge-base.ts +124 -0
- package/src/agents/memory/pattern-learner.ts +143 -0
- package/src/agents/memory/project-mapper.ts +118 -0
- package/src/agents/quality/accessibility.ts +99 -0
- package/src/agents/quality/code-quality.ts +115 -0
- package/src/agents/quality/compatibility.ts +58 -0
- package/src/agents/quality/documentation.ts +105 -0
- package/src/agents/quality/error-handling.ts +96 -0
- package/src/agents/research/competitor-analyzer.ts +45 -0
- package/src/agents/research/cost-analyzer.ts +54 -0
- package/src/agents/research/estimator.ts +60 -0
- package/src/agents/research/ethics-bias.ts +113 -0
- package/src/agents/research/researcher.ts +114 -0
- package/src/agents/research/risk-assessor.ts +63 -0
- package/src/agents/research/tech-advisor.ts +55 -0
- package/src/agents/security/auth.ts +287 -0
- package/src/agents/security/dependency-audit.ts +337 -0
- package/src/agents/security/penetration.ts +262 -0
- package/src/agents/security/privacy.ts +285 -0
- package/src/agents/security/scanner.ts +322 -0
- package/src/agents/security/secrets.ts +249 -0
- package/src/agents/types.ts +66 -0
- package/src/agents/workflow/automation.ts +59 -0
- package/src/agents/workflow/file-manager.ts +52 -0
- package/src/agents/workflow/git-agent.ts +55 -0
- package/src/agents/workflow/reporter.ts +51 -0
- package/src/agents/workflow/search-agent.ts +40 -0
- package/src/agents/workflow/task-coordinator.ts +41 -0
- package/src/agents/workflow/task-planner.ts +47 -0
- package/src/cli.ts +143 -0
- package/src/council/decision-engine.ts +171 -0
- package/src/council/devil-advocate.ts +116 -0
- package/src/council/index.ts +44 -0
- package/src/council/lead-developer.ts +118 -0
- package/src/council/legal-compliance.ts +152 -0
- package/src/council/product-manager.ts +102 -0
- package/src/council/security.ts +172 -0
- package/src/council/system-architect.ts +132 -0
- package/src/council/types.ts +33 -0
- package/src/council/ux-designer.ts +121 -0
- package/src/memory/local.ts +305 -0
- package/src/memory/schema.ts +174 -0
- package/src/memory/sync.ts +274 -0
- package/src/router/complexity-scorer.ts +96 -0
- package/src/router/context-compressor.ts +74 -0
- package/src/router/index.ts +60 -0
- package/src/router/learning-updater.ts +271 -0
- package/src/router/model-selector.ts +83 -0
- package/src/router/rate-monitor.ts +103 -0
- package/src/server.ts +1038 -0
- package/src/skills/development/skill-api-design.ts +329 -0
- package/src/skills/development/skill-auth.ts +271 -0
- package/src/skills/development/skill-ci-cd.ts +0 -0
- package/src/skills/development/skill-crud.ts +209 -0
- package/src/skills/development/skill-db-schema.ts +0 -0
- package/src/skills/development/skill-docker.ts +0 -0
- package/src/skills/development/skill-env-setup.ts +0 -0
- package/src/skills/development/skill-scaffold.ts +323 -0
- package/src/skills/intelligence/skill-complexity-score.ts +69 -0
- package/src/skills/intelligence/skill-cost-track.ts +39 -0
- package/src/skills/intelligence/skill-learning-loop.ts +69 -0
- package/src/skills/intelligence/skill-pattern-detect.ts +38 -0
- package/src/skills/intelligence/skill-rate-watch.ts +61 -0
- package/src/skills/memory/skill-context-compress.ts +98 -0
- package/src/skills/memory/skill-cross-sync.ts +104 -0
- package/src/skills/memory/skill-decision-log.ts +119 -0
- package/src/skills/memory/skill-session-restore.ts +59 -0
- package/src/skills/memory/skill-session-save.ts +94 -0
- package/src/skills/quality/skill-accessibility.ts +0 -0
- package/src/skills/quality/skill-code-review.ts +84 -0
- package/src/skills/quality/skill-docs-gen.ts +0 -0
- package/src/skills/quality/skill-perf-audit.ts +0 -0
- package/src/skills/quality/skill-security-scan.ts +91 -0
- package/src/skills/quality/skill-test-suite.ts +290 -0
- package/src/skills/workflow/skill-deploy.ts +0 -0
- package/src/skills/workflow/skill-git-workflow.ts +0 -0
- package/src/skills/workflow/skill-rollback.ts +0 -0
- package/src/skills/workflow/skill-task-breakdown.ts +0 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import type { AgentPlan, AgentAnalysis, AgentFinding, FindingSeverity } from '../types.js';
|
|
2
|
+
|
|
3
|
+
export function plan(task: string, context?: string): AgentPlan {
|
|
4
|
+
return {
|
|
5
|
+
agent: 'security-scanner',
|
|
6
|
+
task,
|
|
7
|
+
tier: 2,
|
|
8
|
+
approach:
|
|
9
|
+
'Apply OWASP Top 10 methodology: enumerate attack surface, check each category ' +
|
|
10
|
+
'systematically, prioritise critical and high findings, produce actionable remediation.',
|
|
11
|
+
steps: [
|
|
12
|
+
'Identify all entry points: HTTP endpoints, file uploads, WebSocket, CLI args',
|
|
13
|
+
'Map authentication and authorisation boundaries',
|
|
14
|
+
'A01 – Broken Access Control: ownership checks, privilege escalation paths',
|
|
15
|
+
'A02 – Cryptographic Failures: cipher strength, data-in-transit, data-at-rest',
|
|
16
|
+
'A03 – Injection: SQL, NoSQL, OS command, LDAP, template injection',
|
|
17
|
+
'A04 – Insecure Design: missing input validation, business logic flaws',
|
|
18
|
+
'A05 – Security Misconfiguration: debug flags, default creds, verbose errors',
|
|
19
|
+
'A06 – Vulnerable Components: dependency CVEs, outdated libraries',
|
|
20
|
+
'A07 – Authentication Failures: rate limiting, session management, token strength',
|
|
21
|
+
'A08 – Software Integrity: deserialization, supply-chain, CI integrity checks',
|
|
22
|
+
'A09 – Logging Failures: audit trail completeness, sensitive data in logs',
|
|
23
|
+
'A10 – SSRF: user-supplied URLs in outbound calls',
|
|
24
|
+
'Aggregate findings, calculate score, produce verdict and remediation plan',
|
|
25
|
+
],
|
|
26
|
+
checklist: [
|
|
27
|
+
'All HTTP routes require authentication where data is user-specific',
|
|
28
|
+
'Object-level authorisation verifies ownership before returning or mutating records',
|
|
29
|
+
'No MD5 or SHA-1 used for password hashing or data integrity',
|
|
30
|
+
'TLS enforced on all external connections; HSTS header present',
|
|
31
|
+
'SQL queries use parameterised statements or ORM; no string concatenation',
|
|
32
|
+
'eval() and new Function() constructors are absent from production code',
|
|
33
|
+
'Input validated with schema library (zod/joi) at every API boundary',
|
|
34
|
+
'Error responses do not leak stack traces or internal file paths',
|
|
35
|
+
'Debug/development flags disabled in production builds',
|
|
36
|
+
'Default credentials and example secrets removed from all config files',
|
|
37
|
+
'Auth endpoints protected by rate limiting and account-lockout logic',
|
|
38
|
+
'Session tokens stored in httpOnly, Secure, SameSite=Strict cookies',
|
|
39
|
+
'Deserialisation of untrusted data avoided or performed with strict schema',
|
|
40
|
+
'Audit log written for every sensitive operation (login, delete, privilege change)',
|
|
41
|
+
'Passwords and secrets never appear in log output',
|
|
42
|
+
'Outbound HTTP requests validate/whitelist target URLs; no raw user-supplied URLs',
|
|
43
|
+
'npm audit / yarn audit run in CI with zero high/critical failure threshold',
|
|
44
|
+
'Security headers set: CSP, X-Content-Type-Options, X-Frame-Options, Referrer-Policy',
|
|
45
|
+
],
|
|
46
|
+
pitfalls: [
|
|
47
|
+
'Trusting client-supplied IDs without server-side ownership validation (IDOR)',
|
|
48
|
+
'Comparing password hashes with == instead of a constant-time function',
|
|
49
|
+
'Sending res.json(err) in Express error handlers — leaks internal details',
|
|
50
|
+
'Forgetting to validate JWT claims server-side; client-side role inflation',
|
|
51
|
+
'Server-Side Template Injection when user input is interpolated into templates',
|
|
52
|
+
'Prototype pollution through lodash merge on untrusted objects',
|
|
53
|
+
'CORS wildcard (*) combined with credentials:true',
|
|
54
|
+
'Logging req.body at DEBUG level — captures passwords in plaintext',
|
|
55
|
+
],
|
|
56
|
+
patterns: [
|
|
57
|
+
'Parameterised queries / prepared statements for all DB access',
|
|
58
|
+
'Repository pattern isolates data access and makes auth injection consistent',
|
|
59
|
+
'Middleware chain: authenticate → authorise → validate → handle',
|
|
60
|
+
'Allow-list validation (reject unknown fields) via zod strict() mode',
|
|
61
|
+
'Centralised error handler strips internal details before response',
|
|
62
|
+
'Structured logging with automatic redaction of secret fields',
|
|
63
|
+
],
|
|
64
|
+
duration_estimate: context?.includes('large') ? '4-6 hours' : '1-2 hours',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ─── Pattern definitions ───────────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
interface CheckPattern {
|
|
71
|
+
regex: RegExp;
|
|
72
|
+
severity: FindingSeverity;
|
|
73
|
+
category: string;
|
|
74
|
+
description: string;
|
|
75
|
+
fix: string;
|
|
76
|
+
cwe?: string;
|
|
77
|
+
owasp: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const CHECKS: CheckPattern[] = [
|
|
81
|
+
// A01 – Broken Access Control
|
|
82
|
+
{
|
|
83
|
+
regex: /req\.params\.(id|userId|user_id)\b/,
|
|
84
|
+
severity: 'high',
|
|
85
|
+
category: 'A01 Broken Access Control',
|
|
86
|
+
description: 'req.params.id used — verify ownership check exists to prevent IDOR.',
|
|
87
|
+
fix: 'Assert req.user.id === record.userId before returning or mutating the resource.',
|
|
88
|
+
cwe: 'CWE-639',
|
|
89
|
+
owasp: 'A01:2021',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
regex: /role\s*=\s*req\.body\.role|req\.body\[['"]role['"]\]/,
|
|
93
|
+
severity: 'critical',
|
|
94
|
+
category: 'A01 Broken Access Control',
|
|
95
|
+
description: 'Role assigned directly from request body — allows privilege escalation.',
|
|
96
|
+
fix: 'Never accept role from client input. Derive roles server-side from the session.',
|
|
97
|
+
cwe: 'CWE-269',
|
|
98
|
+
owasp: 'A01:2021',
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// A02 – Cryptographic Failures
|
|
102
|
+
{
|
|
103
|
+
regex: /createHash\s*\(\s*['"](?:md5|sha1)['"]\s*\)/i,
|
|
104
|
+
severity: 'high',
|
|
105
|
+
category: 'A02 Cryptographic Failures',
|
|
106
|
+
description: 'Weak cryptographic hash (MD5/SHA-1) detected.',
|
|
107
|
+
fix: 'Replace with SHA-256 or SHA-512 for hashing; use bcrypt/argon2 for passwords.',
|
|
108
|
+
cwe: 'CWE-327',
|
|
109
|
+
owasp: 'A02:2021',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
regex: /createCipher\s*\(\s*['"](?:des|rc4)['"]\s*\)/i,
|
|
113
|
+
severity: 'high',
|
|
114
|
+
category: 'A02 Cryptographic Failures',
|
|
115
|
+
description: 'Broken symmetric cipher (DES/RC4) detected.',
|
|
116
|
+
fix: 'Replace with AES-256-GCM.',
|
|
117
|
+
cwe: 'CWE-327',
|
|
118
|
+
owasp: 'A02:2021',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
regex: /http:\/\/(?!localhost|127\.0\.0\.1|0\.0\.0\.0)/,
|
|
122
|
+
severity: 'medium',
|
|
123
|
+
category: 'A02 Cryptographic Failures',
|
|
124
|
+
description: 'Plain HTTP URL detected — data transmitted without encryption.',
|
|
125
|
+
fix: 'Use HTTPS for all external URLs. Enforce HSTS in production.',
|
|
126
|
+
cwe: 'CWE-319',
|
|
127
|
+
owasp: 'A02:2021',
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
// A03 – Injection
|
|
131
|
+
{
|
|
132
|
+
regex: /['"`]\s*(?:SELECT|INSERT|UPDATE|DELETE)\b[^'"`]*\+\s*(?:req\.|params\.|body\.|query\.)\w+/i,
|
|
133
|
+
severity: 'critical',
|
|
134
|
+
category: 'A03 Injection',
|
|
135
|
+
description: 'String concatenation inside SQL query — SQL injection risk.',
|
|
136
|
+
fix: 'Use parameterised queries: db.query("SELECT ... WHERE id = $1", [id])',
|
|
137
|
+
cwe: 'CWE-89',
|
|
138
|
+
owasp: 'A03:2021',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
regex: /\beval\s*\(|new\s+Function\s*\(/,
|
|
142
|
+
severity: 'critical',
|
|
143
|
+
category: 'A03 Injection',
|
|
144
|
+
description: 'eval() or new Function() detected — JavaScript injection vector.',
|
|
145
|
+
fix: 'Remove eval(). Use JSON.parse() for data or a dedicated expression parser.',
|
|
146
|
+
cwe: 'CWE-95',
|
|
147
|
+
owasp: 'A03:2021',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
regex: /(?:exec|execSync|spawn)\s*\(\s*`[^`]*\$\{(?:req|params|body|query)\./,
|
|
151
|
+
severity: 'critical',
|
|
152
|
+
category: 'A03 Injection',
|
|
153
|
+
description: 'User input interpolated into shell command — OS command injection.',
|
|
154
|
+
fix: 'Use execFile() with a fixed command and an array of sanitised arguments.',
|
|
155
|
+
cwe: 'CWE-78',
|
|
156
|
+
owasp: 'A03:2021',
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
// A04 – Insecure Design
|
|
160
|
+
{
|
|
161
|
+
regex: /req\.body\.\w+\s*(?:&&|\|\||,|\))[^;]{0,120}(?:\.save\s*\(|\.create\s*\(|\.insert\s*\()/,
|
|
162
|
+
severity: 'medium',
|
|
163
|
+
category: 'A04 Insecure Design',
|
|
164
|
+
description: 'Request body values passed to persistence layer without visible validation.',
|
|
165
|
+
fix: 'Validate and sanitise all inputs with zod or joi before saving.',
|
|
166
|
+
cwe: 'CWE-20',
|
|
167
|
+
owasp: 'A04:2021',
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
// A05 – Security Misconfiguration
|
|
171
|
+
{
|
|
172
|
+
regex: /debug\s*[:=]\s*true/i,
|
|
173
|
+
severity: 'medium',
|
|
174
|
+
category: 'A05 Security Misconfiguration',
|
|
175
|
+
description: 'Debug mode flag set to true in source.',
|
|
176
|
+
fix: 'Guard debug features with NODE_ENV checks; never enable in production.',
|
|
177
|
+
cwe: 'CWE-16',
|
|
178
|
+
owasp: 'A05:2021',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
regex: /password\s*[:=]\s*['"](?:admin|root|password|123456|secret|test|demo)['"]/i,
|
|
182
|
+
severity: 'critical',
|
|
183
|
+
category: 'A05 Security Misconfiguration',
|
|
184
|
+
description: 'Default or trivial credential detected in source.',
|
|
185
|
+
fix: 'Remove default credentials. Store only bcrypt hashes; move to env vars.',
|
|
186
|
+
cwe: 'CWE-1392',
|
|
187
|
+
owasp: 'A05:2021',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
regex: /res\s*\.\s*(?:json|send)\s*\(\s*(?:err|error)\s*\)/,
|
|
191
|
+
severity: 'medium',
|
|
192
|
+
category: 'A05 Security Misconfiguration',
|
|
193
|
+
description: 'Raw error object sent in HTTP response — may expose internals.',
|
|
194
|
+
fix: 'Use a centralised error handler that maps errors to safe user-facing messages.',
|
|
195
|
+
cwe: 'CWE-209',
|
|
196
|
+
owasp: 'A05:2021',
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
// A06 – Vulnerable Components
|
|
200
|
+
{
|
|
201
|
+
regex: /require\s*\(\s*['"]node-serialize['"]\s*\)|from\s+['"]node-serialize['"]/,
|
|
202
|
+
severity: 'critical',
|
|
203
|
+
category: 'A06 Vulnerable Components',
|
|
204
|
+
description: 'node-serialize has a known Remote Code Execution vulnerability.',
|
|
205
|
+
fix: 'Remove node-serialize. Use JSON.parse() for safe deserialisation.',
|
|
206
|
+
cwe: 'CWE-502',
|
|
207
|
+
owasp: 'A06:2021',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
regex: /require\s*\(\s*['"]request['"]\s*\)|from\s+['"]request['"]/,
|
|
211
|
+
severity: 'low',
|
|
212
|
+
category: 'A06 Vulnerable Components',
|
|
213
|
+
description: 'The "request" package is deprecated and unmaintained.',
|
|
214
|
+
fix: 'Replace with native fetch() (Node 18+), axios, or got.',
|
|
215
|
+
owasp: 'A06:2021',
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
// A07 – Authentication Failures
|
|
219
|
+
{
|
|
220
|
+
regex: /localStorage\s*\.\s*setItem\s*\(\s*['"][^'"]*(?:token|jwt|auth)[^'"]*['"]/i,
|
|
221
|
+
severity: 'high',
|
|
222
|
+
category: 'A07 Authentication Failures',
|
|
223
|
+
description: 'Auth token stored in localStorage — vulnerable to XSS theft.',
|
|
224
|
+
fix: 'Store tokens in httpOnly, Secure, SameSite=Strict cookies.',
|
|
225
|
+
cwe: 'CWE-922',
|
|
226
|
+
owasp: 'A07:2021',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
regex: /router\s*\.\s*post\s*\(\s*['"]\/(?:login|signin|auth)['"]/i,
|
|
230
|
+
severity: 'high',
|
|
231
|
+
category: 'A07 Authentication Failures',
|
|
232
|
+
description: 'Auth endpoint found — verify rate limiting is applied.',
|
|
233
|
+
fix: 'Apply express-rate-limit to all auth routes to prevent brute-force attacks.',
|
|
234
|
+
cwe: 'CWE-307',
|
|
235
|
+
owasp: 'A07:2021',
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
// A08 – Software Integrity
|
|
239
|
+
{
|
|
240
|
+
regex: /JSON\.parse\s*\(\s*(?:req\.|body\.|params\.|query\.)\w+/,
|
|
241
|
+
severity: 'medium',
|
|
242
|
+
category: 'A08 Software Integrity',
|
|
243
|
+
description: 'JSON.parse on user-supplied data without visible try/catch or schema validation.',
|
|
244
|
+
fix: 'Wrap JSON.parse in try/catch and validate the result structure with zod.',
|
|
245
|
+
cwe: 'CWE-502',
|
|
246
|
+
owasp: 'A08:2021',
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
// A09 – Logging Failures
|
|
250
|
+
{
|
|
251
|
+
regex: /console\s*\.\s*log\s*\([^)]*(?:password|passwd|secret|token|apikey|api_key)[^)]*\)/i,
|
|
252
|
+
severity: 'high',
|
|
253
|
+
category: 'A09 Logging Failures',
|
|
254
|
+
description: 'Sensitive value (password/secret/token) may be written to logs.',
|
|
255
|
+
fix: 'Never log sensitive fields. Redact before passing to the logger.',
|
|
256
|
+
cwe: 'CWE-532',
|
|
257
|
+
owasp: 'A09:2021',
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
// A10 – SSRF
|
|
261
|
+
{
|
|
262
|
+
regex: /(?:fetch|axios\.get|axios\.post|http\.get)\s*\(\s*(?:req\.|body\.|params\.|query\.)\w+/,
|
|
263
|
+
severity: 'critical',
|
|
264
|
+
category: 'A10 SSRF',
|
|
265
|
+
description: 'User-supplied value passed directly to HTTP client — SSRF risk.',
|
|
266
|
+
fix: 'Validate the URL against a strict allow-list of permitted domains. Reject internal IP ranges.',
|
|
267
|
+
cwe: 'CWE-918',
|
|
268
|
+
owasp: 'A10:2021',
|
|
269
|
+
},
|
|
270
|
+
];
|
|
271
|
+
|
|
272
|
+
// ─── Public API ────────────────────────────────────────────────────────────
|
|
273
|
+
|
|
274
|
+
export function analyze(code: string, context?: string): AgentAnalysis {
|
|
275
|
+
const findings: AgentFinding[] = [];
|
|
276
|
+
|
|
277
|
+
for (const check of CHECKS) {
|
|
278
|
+
if (check.regex.test(code)) {
|
|
279
|
+
const finding: AgentFinding = {
|
|
280
|
+
severity: check.severity,
|
|
281
|
+
category: check.category,
|
|
282
|
+
description: check.description,
|
|
283
|
+
fix: check.fix,
|
|
284
|
+
owasp: check.owasp,
|
|
285
|
+
};
|
|
286
|
+
if (check.cwe) finding.cwe = check.cwe;
|
|
287
|
+
findings.push(finding);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const critical = findings.filter(f => f.severity === 'critical').length;
|
|
292
|
+
const high = findings.filter(f => f.severity === 'high').length;
|
|
293
|
+
const medium = findings.filter(f => f.severity === 'medium').length;
|
|
294
|
+
const low = findings.filter(f => f.severity === 'low').length;
|
|
295
|
+
|
|
296
|
+
const raw = 100 - (critical * 25 + high * 10 + medium * 5 + low * 2);
|
|
297
|
+
const score = Math.max(0, raw);
|
|
298
|
+
|
|
299
|
+
const verdict: AgentAnalysis['verdict'] =
|
|
300
|
+
score >= 90 ? 'approved'
|
|
301
|
+
: score >= 70 ? 'approved_with_warnings'
|
|
302
|
+
: score >= 50 ? 'needs_revision'
|
|
303
|
+
: 'rejected';
|
|
304
|
+
|
|
305
|
+
const subject = context ?? 'provided code';
|
|
306
|
+
|
|
307
|
+
const summary =
|
|
308
|
+
findings.length === 0
|
|
309
|
+
? `No OWASP Top 10 violations detected in ${subject}. Score: ${score}/100.`
|
|
310
|
+
: `Found ${findings.length} issue(s) in ${subject}: ${critical} critical, ${high} high, ${medium} medium, ${low} low. Score: ${score}/100 — ${verdict.replace(/_/g, ' ')}.`;
|
|
311
|
+
|
|
312
|
+
return {
|
|
313
|
+
agent: 'security-scanner',
|
|
314
|
+
subject,
|
|
315
|
+
findings,
|
|
316
|
+
score,
|
|
317
|
+
verdict,
|
|
318
|
+
summary,
|
|
319
|
+
critical_count: critical,
|
|
320
|
+
high_count: high,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { AgentPlan, AgentAnalysis, AgentFinding, FindingSeverity } from '../types.js';
|
|
2
|
+
|
|
3
|
+
export interface SecretsFinding {
|
|
4
|
+
type: string;
|
|
5
|
+
value: string; // first 4 chars + ****
|
|
6
|
+
line: number;
|
|
7
|
+
severity: FindingSeverity;
|
|
8
|
+
fix: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ─── Plan ──────────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
export function plan(task: string, _context?: string): AgentPlan {
|
|
14
|
+
return {
|
|
15
|
+
agent: 'secrets',
|
|
16
|
+
task,
|
|
17
|
+
tier: 1,
|
|
18
|
+
approach:
|
|
19
|
+
'Systematically detect, rotate, and vault all credentials. ' +
|
|
20
|
+
'Apply defence-in-depth: scan source, enforce pre-commit hooks, ' +
|
|
21
|
+
'use a secrets manager, and never let secrets reach version control.',
|
|
22
|
+
steps: [
|
|
23
|
+
'Run static scan (this agent) across the entire codebase including .env files',
|
|
24
|
+
'Identify all credential types: API keys, DB connection strings, private keys, tokens',
|
|
25
|
+
'Rotate any exposed credentials immediately — assume they are compromised',
|
|
26
|
+
'Move all secrets to a secrets manager (AWS Secrets Manager, Vault, Doppler)',
|
|
27
|
+
'Replace hardcoded values with environment-variable references',
|
|
28
|
+
'Add .env* to .gitignore; add .env.example with placeholder values',
|
|
29
|
+
'Install a pre-commit hook (git-secrets, gitleaks) to block future commits',
|
|
30
|
+
'Configure CI/CD secret scanning (GitHub secret scanning, Trufflehog action)',
|
|
31
|
+
'Set minimum secret rotation period in policy (90 days for API keys, 30 for DB)',
|
|
32
|
+
'Document which services own which secrets in a secrets inventory',
|
|
33
|
+
],
|
|
34
|
+
checklist: [
|
|
35
|
+
'No secrets committed to the repository (scan with gitleaks/trufflehog)',
|
|
36
|
+
'.env files listed in .gitignore at the repo root',
|
|
37
|
+
'.env.example present with only placeholder values, no real secrets',
|
|
38
|
+
'All API keys loaded from process.env at runtime, not import-time constants',
|
|
39
|
+
'AWS credentials use IAM roles / instance profiles, not access key + secret pairs',
|
|
40
|
+
'Private keys stored in a hardware security module or secrets manager',
|
|
41
|
+
'JWT_SECRET is at least 256 bits of random entropy, not a dictionary word',
|
|
42
|
+
'Database connection strings contain no credentials (use socket auth or Secrets Manager)',
|
|
43
|
+
'GitHub tokens scoped to minimal required permissions and set to expire',
|
|
44
|
+
'Secret scanning enabled in GitHub repository settings',
|
|
45
|
+
'Pre-commit hook configured to block secrets (git-secrets or gitleaks)',
|
|
46
|
+
'CI pipeline fails if any secret pattern is detected in changed files',
|
|
47
|
+
'Secrets rotated after any team-member departure or suspected exposure',
|
|
48
|
+
'Audit log maintained of who accessed each secret and when',
|
|
49
|
+
],
|
|
50
|
+
pitfalls: [
|
|
51
|
+
'Committing .env files accidentally when .gitignore is misconfigured',
|
|
52
|
+
'Hardcoding secrets in Dockerfile ARG/ENV layers visible in image history',
|
|
53
|
+
'Logging full request headers which include Authorization bearer tokens',
|
|
54
|
+
'Storing secrets in client-side code bundled into the browser',
|
|
55
|
+
'Using short or guessable JWT secrets ("secret", "mysecret", "1234")',
|
|
56
|
+
'Checking in AWS credentials profile files (~/.aws/credentials) via CI runners',
|
|
57
|
+
'Embedding secrets in CI/CD YAML files instead of using encrypted variables',
|
|
58
|
+
],
|
|
59
|
+
patterns: [
|
|
60
|
+
'Twelve-Factor App: config via environment variables',
|
|
61
|
+
'Secrets manager pattern: centralised vault with short-lived leases',
|
|
62
|
+
'Secret rotation pattern: automated rotation with zero-downtime swap',
|
|
63
|
+
'Pre-commit hook pattern: block secrets before they enter git history',
|
|
64
|
+
],
|
|
65
|
+
duration_estimate: '2-4 hours for full secrets audit and remediation',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ─── Scan patterns ─────────────────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
interface ScanPattern {
|
|
72
|
+
type: string;
|
|
73
|
+
regex: RegExp;
|
|
74
|
+
severity: FindingSeverity;
|
|
75
|
+
fix: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const PATTERNS: ScanPattern[] = [
|
|
79
|
+
{
|
|
80
|
+
type: 'AWS Access Key',
|
|
81
|
+
regex: /AKIA[0-9A-Z]{16}/,
|
|
82
|
+
severity: 'critical',
|
|
83
|
+
fix: 'Immediately revoke this AWS access key in the IAM console. Use IAM roles or instance profiles instead.',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'AWS Secret Access Key',
|
|
87
|
+
regex: /aws_secret_access_key\s*=\s*['"]?[A-Za-z0-9/+]{40}['"]?/i,
|
|
88
|
+
severity: 'critical',
|
|
89
|
+
fix: 'Rotate the AWS secret access key immediately. Store credentials in AWS Secrets Manager or via instance role.',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: 'GitHub Token (ghp_)',
|
|
93
|
+
regex: /ghp_[a-zA-Z0-9]{36}/,
|
|
94
|
+
severity: 'critical',
|
|
95
|
+
fix: 'Revoke this GitHub personal access token immediately. Use short-lived tokens with minimal scopes.',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: 'GitHub Token (env var)',
|
|
99
|
+
regex: /github_token\s*=\s*['"][a-zA-Z0-9_]{20,}['"]/i,
|
|
100
|
+
severity: 'high',
|
|
101
|
+
fix: 'Move the GitHub token to a CI/CD secret variable. Never hardcode tokens.',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'RSA Private Key',
|
|
105
|
+
regex: /-----BEGIN RSA PRIVATE KEY-----/,
|
|
106
|
+
severity: 'critical',
|
|
107
|
+
fix: 'Remove the private key from source. Store in a secrets manager or HSM. Rotate the key pair immediately.',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: 'EC Private Key',
|
|
111
|
+
regex: /-----BEGIN EC PRIVATE KEY-----/,
|
|
112
|
+
severity: 'critical',
|
|
113
|
+
fix: 'Remove the private key from source. Store in a secrets manager or HSM. Rotate the key pair immediately.',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'OpenSSH Private Key',
|
|
117
|
+
regex: /-----BEGIN OPENSSH PRIVATE KEY-----/,
|
|
118
|
+
severity: 'critical',
|
|
119
|
+
fix: 'Remove the private key from source. Store in a secrets manager or HSM. Rotate the key pair immediately.',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'API Key (generic)',
|
|
123
|
+
regex: /(?:api_key|apikey|api-key)\s*[:=]\s*['"][a-zA-Z0-9_\-]{20,}['"]/i,
|
|
124
|
+
severity: 'high',
|
|
125
|
+
fix: 'Move the API key to an environment variable. Load via process.env.API_KEY at runtime.',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'JWT Secret',
|
|
129
|
+
regex: /jwt_secret\s*[:=]\s*['"][^'"]{8,}['"]/i,
|
|
130
|
+
severity: 'high',
|
|
131
|
+
fix: 'Move JWT_SECRET to an environment variable. Use at least 256 bits of random entropy.',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'Hardcoded Password',
|
|
135
|
+
regex: /password\s*[:=]\s*['"][^'"]{4,}['"]/i,
|
|
136
|
+
severity: 'high',
|
|
137
|
+
fix: 'Remove hardcoded password. Store in environment variable and load at runtime.',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
type: 'MongoDB Connection String',
|
|
141
|
+
regex: /mongodb(?:\+srv)?:\/\/[^:]+:[^@]+@/,
|
|
142
|
+
severity: 'critical',
|
|
143
|
+
fix: 'Rotate MongoDB credentials immediately. Use environment variable MONGODB_URI with no credentials in source.',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: 'PostgreSQL Connection String',
|
|
147
|
+
regex: /postgres(?:ql)?:\/\/[^:]+:[^@]+@/,
|
|
148
|
+
severity: 'critical',
|
|
149
|
+
fix: 'Rotate PostgreSQL credentials immediately. Use DATABASE_URL environment variable.',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
type: 'MySQL Connection String',
|
|
153
|
+
regex: /mysql:\/\/[^:]+:[^@]+@/,
|
|
154
|
+
severity: 'critical',
|
|
155
|
+
fix: 'Rotate MySQL credentials immediately. Use DATABASE_URL environment variable.',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: 'Slack Token',
|
|
159
|
+
regex: /xox[baprs]-[0-9A-Za-z\-]{10,}/,
|
|
160
|
+
severity: 'high',
|
|
161
|
+
fix: 'Revoke this Slack token immediately. Store in a secrets manager.',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
type: 'Generic High-Entropy Secret',
|
|
165
|
+
regex: /(?:secret|token|key|passwd)\s*[:=]\s*['"][A-Za-z0-9+/=_\-]{32,}['"]/i,
|
|
166
|
+
severity: 'medium',
|
|
167
|
+
fix: 'Review this value. If it is a secret, move it to an environment variable or secrets manager.',
|
|
168
|
+
},
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
// ─── Helper: mask value ────────────────────────────────────────────────────
|
|
172
|
+
|
|
173
|
+
function maskValue(raw: string): string {
|
|
174
|
+
const match = raw.match(/['"]([^'"]+)['"]/);
|
|
175
|
+
const secret = match ? match[1] : raw.replace(/.*[:=]\s*/, '');
|
|
176
|
+
return secret.length >= 4 ? `${secret.slice(0, 4)}****` : '****';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ─── Public API ────────────────────────────────────────────────────────────
|
|
180
|
+
|
|
181
|
+
export function scan(text: string): SecretsFinding[] {
|
|
182
|
+
const findings: SecretsFinding[] = [];
|
|
183
|
+
const lines = text.split('\n');
|
|
184
|
+
|
|
185
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
186
|
+
const line = lines[lineIndex];
|
|
187
|
+
for (const pattern of PATTERNS) {
|
|
188
|
+
const match = line.match(pattern.regex);
|
|
189
|
+
if (match) {
|
|
190
|
+
findings.push({
|
|
191
|
+
type: pattern.type,
|
|
192
|
+
value: maskValue(match[0]),
|
|
193
|
+
line: lineIndex + 1,
|
|
194
|
+
severity: pattern.severity,
|
|
195
|
+
fix: pattern.fix,
|
|
196
|
+
});
|
|
197
|
+
break; // one finding per pattern per line
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return findings;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function analyze(code: string, context?: string): AgentAnalysis {
|
|
206
|
+
const secretFindings = scan(code);
|
|
207
|
+
|
|
208
|
+
const findings: AgentFinding[] = secretFindings.map(sf => ({
|
|
209
|
+
severity: sf.severity,
|
|
210
|
+
category: 'Credential Exposure',
|
|
211
|
+
description: `${sf.type} detected at line ${sf.line} (value: ${sf.value})`,
|
|
212
|
+
fix: sf.fix,
|
|
213
|
+
location: `line ${sf.line}`,
|
|
214
|
+
cwe: 'CWE-798',
|
|
215
|
+
owasp: 'A02:2021',
|
|
216
|
+
}));
|
|
217
|
+
|
|
218
|
+
const critical = findings.filter(f => f.severity === 'critical').length;
|
|
219
|
+
const high = findings.filter(f => f.severity === 'high').length;
|
|
220
|
+
const medium = findings.filter(f => f.severity === 'medium').length;
|
|
221
|
+
const low = findings.filter(f => f.severity === 'low').length;
|
|
222
|
+
|
|
223
|
+
const raw = 100 - (critical * 25 + high * 10 + medium * 5 + low * 2);
|
|
224
|
+
const score = Math.max(0, raw);
|
|
225
|
+
|
|
226
|
+
const verdict: AgentAnalysis['verdict'] =
|
|
227
|
+
score >= 90 ? 'approved'
|
|
228
|
+
: score >= 70 ? 'approved_with_warnings'
|
|
229
|
+
: score >= 50 ? 'needs_revision'
|
|
230
|
+
: 'rejected';
|
|
231
|
+
|
|
232
|
+
const subject = context ?? 'provided code';
|
|
233
|
+
|
|
234
|
+
const summary =
|
|
235
|
+
findings.length === 0
|
|
236
|
+
? `No credentials or secrets detected in ${subject}. Score: ${score}/100.`
|
|
237
|
+
: `Found ${findings.length} credential(s) in ${subject}: ${critical} critical, ${high} high, ${medium} medium. Score: ${score}/100 — ${verdict.replace(/_/g, ' ')}.`;
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
agent: 'secrets',
|
|
241
|
+
subject,
|
|
242
|
+
findings,
|
|
243
|
+
score,
|
|
244
|
+
verdict,
|
|
245
|
+
summary,
|
|
246
|
+
critical_count: critical,
|
|
247
|
+
high_count: high,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type WorkerAgentType =
|
|
2
|
+
| 'coder' | 'reviewer' | 'tester' | 'debugger' | 'refactor'
|
|
3
|
+
| 'database' | 'api' | 'frontend' | 'backend' | 'devops'
|
|
4
|
+
| 'performance' | 'migration'
|
|
5
|
+
| 'security-scanner' | 'auth' | 'privacy' | 'secrets'
|
|
6
|
+
| 'dependency-audit' | 'penetration'
|
|
7
|
+
| 'context-manager' | 'decision-logger' | 'project-mapper'
|
|
8
|
+
| 'pattern-learner' | 'knowledge-base'
|
|
9
|
+
| 'researcher' | 'tech-advisor' | 'cost-analyzer'
|
|
10
|
+
| 'competitor-analyzer' | 'risk-assessor' | 'estimator'
|
|
11
|
+
| 'ethics-bias'
|
|
12
|
+
| 'code-quality' | 'documentation' | 'accessibility' | 'compatibility' | 'error-handling'
|
|
13
|
+
| 'task-planner' | 'task-coordinator' | 'file-manager' | 'git-agent'
|
|
14
|
+
| 'search-agent' | 'reporter' | 'automation';
|
|
15
|
+
|
|
16
|
+
export type FindingSeverity = 'critical' | 'high' | 'medium' | 'low' | 'info';
|
|
17
|
+
|
|
18
|
+
export interface AgentFinding {
|
|
19
|
+
severity: FindingSeverity;
|
|
20
|
+
category: string;
|
|
21
|
+
description: string;
|
|
22
|
+
fix: string;
|
|
23
|
+
location?: string;
|
|
24
|
+
cwe?: string;
|
|
25
|
+
owasp?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AgentPlan {
|
|
29
|
+
agent: WorkerAgentType;
|
|
30
|
+
task: string;
|
|
31
|
+
tier: 1 | 2 | 3;
|
|
32
|
+
approach: string;
|
|
33
|
+
steps: string[];
|
|
34
|
+
checklist: string[];
|
|
35
|
+
pitfalls: string[];
|
|
36
|
+
patterns: string[];
|
|
37
|
+
duration_estimate: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface AgentAnalysis {
|
|
41
|
+
agent: WorkerAgentType;
|
|
42
|
+
subject: string;
|
|
43
|
+
findings: AgentFinding[];
|
|
44
|
+
score: number;
|
|
45
|
+
verdict: 'approved' | 'approved_with_warnings' | 'needs_revision' | 'rejected';
|
|
46
|
+
summary: string;
|
|
47
|
+
critical_count: number;
|
|
48
|
+
high_count: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface AgentTask {
|
|
52
|
+
id: string;
|
|
53
|
+
agent: WorkerAgentType;
|
|
54
|
+
task: string;
|
|
55
|
+
code?: string;
|
|
56
|
+
context?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AgentResult {
|
|
60
|
+
id: string;
|
|
61
|
+
agent: WorkerAgentType;
|
|
62
|
+
plan?: AgentPlan;
|
|
63
|
+
analysis?: AgentAnalysis;
|
|
64
|
+
duration_ms: number;
|
|
65
|
+
error?: string;
|
|
66
|
+
}
|