@jigyasudham/veto 0.8.2 → 1.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 +209 -52
- package/dist/agents/executor.js +36 -3
- package/dist/cli.js +350 -51
- package/dist/context/reader.js +113 -0
- package/dist/council/index.js +3 -1
- package/dist/plugins/loader.js +49 -0
- package/dist/router/index.js +2 -2
- package/dist/router/learning-updater.js +45 -1
- package/dist/server.js +478 -14
- package/dist/watcher/index.js +77 -0
- package/dist/workflow/pipeline.js +64 -0
- package/package.json +12 -3
- package/.claude/settings.local.json +0 -9
- package/src/adapters/claude.ts +0 -70
- package/src/adapters/codex.ts +0 -71
- package/src/adapters/gemini.ts +0 -71
- package/src/adapters/index.ts +0 -217
- package/src/agents/development/api.ts +0 -120
- package/src/agents/development/backend.ts +0 -85
- package/src/agents/development/coder.ts +0 -213
- package/src/agents/development/database.ts +0 -83
- package/src/agents/development/debugger.ts +0 -238
- package/src/agents/development/devops.ts +0 -86
- package/src/agents/development/frontend.ts +0 -85
- package/src/agents/development/migration.ts +0 -144
- package/src/agents/development/performance.ts +0 -144
- package/src/agents/development/refactor.ts +0 -86
- package/src/agents/development/reviewer.ts +0 -268
- package/src/agents/development/tester.ts +0 -151
- package/src/agents/executor.ts +0 -158
- package/src/agents/memory/context-manager.ts +0 -171
- package/src/agents/memory/decision-logger.ts +0 -160
- package/src/agents/memory/knowledge-base.ts +0 -124
- package/src/agents/memory/pattern-learner.ts +0 -143
- package/src/agents/memory/project-mapper.ts +0 -118
- package/src/agents/quality/accessibility.ts +0 -99
- package/src/agents/quality/code-quality.ts +0 -115
- package/src/agents/quality/compatibility.ts +0 -58
- package/src/agents/quality/documentation.ts +0 -105
- package/src/agents/quality/error-handling.ts +0 -96
- package/src/agents/research/competitor-analyzer.ts +0 -45
- package/src/agents/research/cost-analyzer.ts +0 -54
- package/src/agents/research/estimator.ts +0 -60
- package/src/agents/research/ethics-bias.ts +0 -113
- package/src/agents/research/researcher.ts +0 -114
- package/src/agents/research/risk-assessor.ts +0 -63
- package/src/agents/research/tech-advisor.ts +0 -55
- package/src/agents/security/auth.ts +0 -287
- package/src/agents/security/dependency-audit.ts +0 -337
- package/src/agents/security/penetration.ts +0 -262
- package/src/agents/security/privacy.ts +0 -285
- package/src/agents/security/scanner.ts +0 -322
- package/src/agents/security/secrets.ts +0 -249
- package/src/agents/types.ts +0 -66
- package/src/agents/workflow/automation.ts +0 -59
- package/src/agents/workflow/file-manager.ts +0 -52
- package/src/agents/workflow/git-agent.ts +0 -55
- package/src/agents/workflow/reporter.ts +0 -51
- package/src/agents/workflow/search-agent.ts +0 -40
- package/src/agents/workflow/task-coordinator.ts +0 -41
- package/src/agents/workflow/task-planner.ts +0 -47
- package/src/cli.ts +0 -135
- package/src/council/decision-engine.ts +0 -171
- package/src/council/devil-advocate.ts +0 -116
- package/src/council/index.ts +0 -44
- package/src/council/lead-developer.ts +0 -118
- package/src/council/legal-compliance.ts +0 -152
- package/src/council/product-manager.ts +0 -102
- package/src/council/security.ts +0 -172
- package/src/council/system-architect.ts +0 -132
- package/src/council/types.ts +0 -33
- package/src/council/ux-designer.ts +0 -121
- package/src/memory/local.ts +0 -305
- package/src/memory/schema.ts +0 -174
- package/src/memory/sync.ts +0 -274
- package/src/router/complexity-scorer.ts +0 -96
- package/src/router/context-compressor.ts +0 -74
- package/src/router/index.ts +0 -60
- package/src/router/learning-updater.ts +0 -271
- package/src/router/model-selector.ts +0 -83
- package/src/router/rate-monitor.ts +0 -103
- package/src/server.ts +0 -1038
- package/src/skills/development/skill-api-design.ts +0 -329
- package/src/skills/development/skill-auth.ts +0 -271
- package/src/skills/development/skill-ci-cd.ts +0 -0
- package/src/skills/development/skill-crud.ts +0 -209
- 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 +0 -323
- package/src/skills/intelligence/skill-complexity-score.ts +0 -69
- package/src/skills/intelligence/skill-cost-track.ts +0 -39
- package/src/skills/intelligence/skill-learning-loop.ts +0 -69
- package/src/skills/intelligence/skill-pattern-detect.ts +0 -38
- package/src/skills/intelligence/skill-rate-watch.ts +0 -61
- package/src/skills/memory/skill-context-compress.ts +0 -98
- package/src/skills/memory/skill-cross-sync.ts +0 -104
- package/src/skills/memory/skill-decision-log.ts +0 -119
- package/src/skills/memory/skill-session-restore.ts +0 -59
- package/src/skills/memory/skill-session-save.ts +0 -94
- package/src/skills/quality/skill-accessibility.ts +0 -0
- package/src/skills/quality/skill-code-review.ts +0 -84
- 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 +0 -91
- package/src/skills/quality/skill-test-suite.ts +0 -290
- 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 +0 -20
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import type { AgentPlan } from '../types.js';
|
|
2
|
-
|
|
3
|
-
// ─── System-type detection ─────────────────────────────────────────────────
|
|
4
|
-
|
|
5
|
-
type SystemType = 'web-api' | 'web-frontend' | 'auth-system' | 'file-upload' | 'generic';
|
|
6
|
-
|
|
7
|
-
function detectSystemType(task: string): SystemType {
|
|
8
|
-
const t = task.toLowerCase();
|
|
9
|
-
if (/\bfile\s*upload\b|multipart|multer|form[\s-]?data|attachment/.test(t)) return 'file-upload';
|
|
10
|
-
if (/\bauth(?:entication)?\b|login|signin|password|oauth|session|jwt|mfa/.test(t)) return 'auth-system';
|
|
11
|
-
if (/\bapi\b|rest(?:ful)?|graphql|endpoint|route|swagger/.test(t)) return 'web-api';
|
|
12
|
-
if (/\bfrontend\b|react|vue|angular|spa|browser|html|dom/.test(t)) return 'web-frontend';
|
|
13
|
-
return 'generic';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// ─── Data maps ────────────────────────────────────────────────────────────
|
|
17
|
-
|
|
18
|
-
const APPROACH: Record<SystemType, string> = {
|
|
19
|
-
'web-api':
|
|
20
|
-
'Map all API endpoints, enumerate authentication requirements, then systematically test auth bypass, ' +
|
|
21
|
-
'IDOR, injection, SSRF, rate limiting, header security, and CORS misconfiguration.',
|
|
22
|
-
'web-frontend':
|
|
23
|
-
'Enumerate all user-controlled input surfaces and event handlers, then test for XSS, CSRF, ' +
|
|
24
|
-
'clickjacking, open redirect, content injection, and client-side storage misuse.',
|
|
25
|
-
'auth-system':
|
|
26
|
-
'Attack the authentication surface: attempt brute force, account enumeration via timing/response ' +
|
|
27
|
-
'differences, session fixation, token prediction, MFA bypass, and password reset flaws.',
|
|
28
|
-
'file-upload':
|
|
29
|
-
'Test file type validation bypass, path traversal via filename, execution of uploaded content, ' +
|
|
30
|
-
'storage disclosure, and denial of service via large or malformed files.',
|
|
31
|
-
generic:
|
|
32
|
-
'Apply a full-scope penetration test methodology: reconnaissance, threat modelling, vulnerability ' +
|
|
33
|
-
'scanning, exploitation, and post-exploitation reporting.',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const STEPS: Record<SystemType, string[]> = {
|
|
37
|
-
'web-api': [
|
|
38
|
-
'Reconnaissance: enumerate endpoints via OpenAPI spec, JS bundles, and forced browsing',
|
|
39
|
-
'Authentication bypass: test unauthenticated access to every endpoint',
|
|
40
|
-
'Broken Object Level Authorisation (BOLA/IDOR): replace IDs with other users\' IDs',
|
|
41
|
-
'Broken Function Level Authorisation: access admin/privileged endpoints as low-privilege user',
|
|
42
|
-
'SQL injection: test string/integer parameters with single quotes and UNION payloads',
|
|
43
|
-
'NoSQL injection: inject {"$gt": ""} into JSON body parameters',
|
|
44
|
-
'Command injection: test parameters used in file paths or shell commands',
|
|
45
|
-
'Mass assignment: send undocumented fields (role, isAdmin) in POST/PUT body',
|
|
46
|
-
'SSRF: submit internal URLs (http://169.254.169.254, http://localhost) to URL-accepting parameters',
|
|
47
|
-
'Rate limiting: send 100+ requests/second to auth and sensitive endpoints',
|
|
48
|
-
'Security headers: verify CSP, HSTS, X-Content-Type-Options, X-Frame-Options, Referrer-Policy',
|
|
49
|
-
'CORS: check for wildcard origin or reflection of Origin header with credentials',
|
|
50
|
-
'Verbose errors: trigger 500 errors and check for stack traces in the response body',
|
|
51
|
-
'JWT attacks: test alg:none, weak secrets (brute force HS256), RS/HS confusion',
|
|
52
|
-
],
|
|
53
|
-
'web-frontend': [
|
|
54
|
-
'Reflected XSS: inject <script>alert(1)</script> into every URL parameter and form field',
|
|
55
|
-
'Stored XSS: submit XSS payloads in persistent fields (username, bio, comments)',
|
|
56
|
-
'DOM-based XSS: review JavaScript for innerHTML, document.write, eval with user data',
|
|
57
|
-
'CSRF: submit state-changing requests without CSRF token from a cross-origin page',
|
|
58
|
-
'Clickjacking: embed the page in an iframe; check for X-Frame-Options or CSP frame-ancestors',
|
|
59
|
-
'Open redirect: test redirect parameters with https://evil.com as the value',
|
|
60
|
-
'Client-side template injection: inject {{7*7}} into Angular/Handlebars templates',
|
|
61
|
-
'HTML injection: inject <img src=x onerror=alert(1)> into reflected fields',
|
|
62
|
-
'localStorage secret exposure: check stored tokens via browser devtools',
|
|
63
|
-
'postMessage attacks: look for unvalidated message event listeners',
|
|
64
|
-
'Content-Security-Policy bypass: look for unsafe-inline, unsafe-eval, or overly broad sources',
|
|
65
|
-
'Sensitive data in URL: check query strings for tokens, passwords, or PII',
|
|
66
|
-
'Third-party script integrity: verify Subresource Integrity (SRI) on CDN scripts',
|
|
67
|
-
],
|
|
68
|
-
'auth-system': [
|
|
69
|
-
'Username enumeration: compare response time/body for valid vs invalid usernames',
|
|
70
|
-
'Password brute force: attempt 10,000 common passwords; verify rate limiting and lockout',
|
|
71
|
-
'Account lockout bypass: vary IP (X-Forwarded-For), vary username case, distribute attempts',
|
|
72
|
-
'Session fixation: set a known session ID before login; check if it is preserved post-auth',
|
|
73
|
-
'Concurrent session attack: log in twice; verify previous session is invalidated if not intended',
|
|
74
|
-
'Session token prediction: collect 100 session tokens and test for sequential or low-entropy patterns',
|
|
75
|
-
'Token reuse after logout: capture a JWT/session token; log out; replay the token',
|
|
76
|
-
'Password reset poisoning: manipulate Host header or forward headers to poison reset link',
|
|
77
|
-
'MFA bypass: attempt to skip MFA step by directly calling authenticated endpoints',
|
|
78
|
-
'OAuth state forgery: replay a used authorisation code or tamper with the state parameter',
|
|
79
|
-
'JWT algorithm confusion: change RS256 to HS256 and sign with the public key',
|
|
80
|
-
'Privilege escalation via JWT claims: modify role claim in an unsigned/weak-signature token',
|
|
81
|
-
'Remember-me token hijacking: extract persistent cookie value and replay from a new session',
|
|
82
|
-
'Account takeover via email change: change email without re-authentication or verification',
|
|
83
|
-
],
|
|
84
|
-
'file-upload': [
|
|
85
|
-
'MIME type bypass: upload a PHP/JSP/ASP file with image/jpeg content type',
|
|
86
|
-
'Extension bypass: test double extension (shell.php.jpg), null byte (shell.php%00.jpg)',
|
|
87
|
-
'Magic bytes bypass: prepend valid image magic bytes to a server-side script',
|
|
88
|
-
'Path traversal via filename: submit ../../../etc/passwd as the filename',
|
|
89
|
-
'Zip slip: upload a zip archive with ../ entries that extract outside the target directory',
|
|
90
|
-
'Stored XSS via SVG: upload an SVG file containing <script> or onload handler',
|
|
91
|
-
'XXE via XML upload: upload an XML/XLSX/DOCX with an external entity reference',
|
|
92
|
-
'RCE via server-side script execution: upload a script to a web-accessible directory',
|
|
93
|
-
'Storage disclosure: guess or enumerate upload paths to access other users\' files',
|
|
94
|
-
'Denial of service via upload: send a very large file, a zip bomb, or a decompression bomb',
|
|
95
|
-
'SSRF via image processing: supply a URL-based image src pointing to internal services',
|
|
96
|
-
'Metadata exfiltration: upload an image with EXIF data and verify the server strips it',
|
|
97
|
-
],
|
|
98
|
-
generic: [
|
|
99
|
-
'Reconnaissance: passive (WHOIS, DNS, Shodan) and active (port scan, banner grab)',
|
|
100
|
-
'Threat modelling: identify assets, entry points, trust boundaries, and threat actors',
|
|
101
|
-
'Vulnerability scanning: run automated scanner (Nessus, OpenVAS, ZAP, Burp Suite)',
|
|
102
|
-
'Authentication testing: brute force, bypass, session management flaws',
|
|
103
|
-
'Injection testing: SQL, NoSQL, OS command, LDAP, template, XML injection',
|
|
104
|
-
'Broken access control testing: IDOR, privilege escalation, path traversal',
|
|
105
|
-
'Cryptographic testing: weak ciphers, certificate validation, key exposure',
|
|
106
|
-
'Insecure direct object references: enumerate and swap resource IDs',
|
|
107
|
-
'Security misconfiguration: default credentials, verbose errors, open admin interfaces',
|
|
108
|
-
'Sensitive data exposure: HTTP traffic, logs, error messages, client-side storage',
|
|
109
|
-
'API security: undocumented endpoints, mass assignment, improper rate limiting',
|
|
110
|
-
'Network-level: open ports, unnecessary services, firewall bypass, DNS zone transfer',
|
|
111
|
-
'Post-exploitation: lateral movement, persistence, data exfiltration paths',
|
|
112
|
-
'Reporting: CVSS scoring, business impact assessment, remediation priority ranking',
|
|
113
|
-
],
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const CHECKLIST: Record<SystemType, string[]> = {
|
|
117
|
-
'web-api': [
|
|
118
|
-
'All endpoints require valid authentication token',
|
|
119
|
-
'IDOR test: swapping another user\'s ID returns 403, not the resource',
|
|
120
|
-
'Admin endpoints return 403 to non-admin authenticated users',
|
|
121
|
-
'SQL injection payloads in all parameters return no data or 400, not 500',
|
|
122
|
-
'eval() and shell execution with user input are absent',
|
|
123
|
-
'Internal URLs submitted to URL parameters are blocked',
|
|
124
|
-
'Auth endpoints respond with 429 after 10 rapid requests',
|
|
125
|
-
'CORS: only listed domains can send credentialed requests',
|
|
126
|
-
'Security headers present on all API responses',
|
|
127
|
-
'Error responses contain a generic message, not stack traces',
|
|
128
|
-
'JWT alg:none and HS/RS confusion attacks are rejected',
|
|
129
|
-
'Mass assignment: undocumented fields are ignored, not persisted',
|
|
130
|
-
'GraphQL introspection disabled in production',
|
|
131
|
-
'Verbose error messages disabled; internal paths not exposed',
|
|
132
|
-
],
|
|
133
|
-
'web-frontend': [
|
|
134
|
-
'All user input is HTML-escaped before insertion into the DOM',
|
|
135
|
-
'Content-Security-Policy header present and does not contain unsafe-inline',
|
|
136
|
-
'X-Frame-Options: DENY or CSP frame-ancestors \'none\' present',
|
|
137
|
-
'All state-changing requests require a CSRF token or SameSite=Strict cookie',
|
|
138
|
-
'Redirect parameters validate against an allow-list of trusted destinations',
|
|
139
|
-
'No sensitive data (tokens, PII) stored in localStorage or sessionStorage',
|
|
140
|
-
'postMessage listeners validate event origin before processing',
|
|
141
|
-
'SRI hashes present on all CDN-loaded scripts and stylesheets',
|
|
142
|
-
'No Angular/Handlebars/Mustache template injection vectors',
|
|
143
|
-
'Referrer-Policy header limits cross-origin referrer information',
|
|
144
|
-
],
|
|
145
|
-
'auth-system': [
|
|
146
|
-
'Username enumeration: identical response for valid and invalid usernames',
|
|
147
|
-
'Rate limiting enforced: 10 attempts per IP per 15 minutes on login',
|
|
148
|
-
'Account lockout after 5 failures; lockout is resolvable via email',
|
|
149
|
-
'Session ID changes on login (fixation prevention)',
|
|
150
|
-
'Old session invalidated after password change',
|
|
151
|
-
'JWT tokens are rejected after logout (revocation list or short TTL)',
|
|
152
|
-
'Password reset links expire after 1 hour and are single-use',
|
|
153
|
-
'MFA cannot be skipped by directly calling authenticated endpoints',
|
|
154
|
-
'Session tokens are at least 128 bits of entropy',
|
|
155
|
-
'HTTPS enforced; HSTS header with includeSubDomains present',
|
|
156
|
-
'OAuth state parameter required and validated on callback',
|
|
157
|
-
'JWT alg is explicitly set server-side; alg:none is rejected',
|
|
158
|
-
],
|
|
159
|
-
'file-upload': [
|
|
160
|
-
'Accepted MIME types validated server-side against an allow-list',
|
|
161
|
-
'File extension validated against an allow-list (not a deny-list)',
|
|
162
|
-
'Magic bytes checked for image uploads using a file type library',
|
|
163
|
-
'Uploaded files stored outside the web root or in a dedicated blob store',
|
|
164
|
-
'Filenames sanitised: path components stripped, UUID used as stored name',
|
|
165
|
-
'File size limit enforced server-side (not only client-side)',
|
|
166
|
-
'Uploaded files served with Content-Disposition: attachment to prevent execution',
|
|
167
|
-
'SVG uploads sanitised or served from a separate origin',
|
|
168
|
-
'Zip archives unpacked with path traversal protection',
|
|
169
|
-
'EXIF metadata stripped from images before storage',
|
|
170
|
-
'Anti-virus or malware scanning integrated into the upload pipeline',
|
|
171
|
-
'Upload directory not publicly accessible via direct URL',
|
|
172
|
-
],
|
|
173
|
-
generic: [
|
|
174
|
-
'Attack surface fully enumerated and documented',
|
|
175
|
-
'All high/critical severity findings remediated before go-live',
|
|
176
|
-
'Automated scanner (Burp/ZAP) run with active scanning enabled',
|
|
177
|
-
'Manual testing performed for logic flaws not detectable by scanners',
|
|
178
|
-
'Authentication and session management tested end-to-end',
|
|
179
|
-
'All injection categories tested across every input parameter',
|
|
180
|
-
'Network exposure reviewed: only required ports open externally',
|
|
181
|
-
'Security misconfiguration check: no default credentials, no test pages in production',
|
|
182
|
-
'Finding report includes CVSS score and business impact for each issue',
|
|
183
|
-
'Remediation verification: re-test each finding after fix is deployed',
|
|
184
|
-
'Executive summary and technical report produced',
|
|
185
|
-
'Penetration test signed off by security lead before production release',
|
|
186
|
-
],
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const PITFALLS: Record<SystemType, string[]> = {
|
|
190
|
-
'web-api': [
|
|
191
|
-
'Testing only the happy path — attackers focus on error paths and edge cases',
|
|
192
|
-
'Stopping at authentication bypass without testing authorisation (IDOR)',
|
|
193
|
-
'Not testing GraphQL or WebSocket endpoints alongside REST',
|
|
194
|
-
'Missing business logic flaws that automated scanners cannot detect',
|
|
195
|
-
],
|
|
196
|
-
'web-frontend': [
|
|
197
|
-
'Only testing XSS in visible input fields — DOM-based XSS lives in JavaScript',
|
|
198
|
-
'Assuming a CSP header prevents all XSS — test for bypasses (unsafe-inline, JSONP endpoints)',
|
|
199
|
-
'Not testing in multiple browsers — DOM behaviour differs',
|
|
200
|
-
'Overlooking postMessage and custom event handlers as injection points',
|
|
201
|
-
],
|
|
202
|
-
'auth-system': [
|
|
203
|
-
'Testing only the login page — password reset, OAuth callback, and MFA endpoints are also in scope',
|
|
204
|
-
'Not testing for timing side-channels in username validation',
|
|
205
|
-
'Assuming short-lived JWTs are safe — test for claims manipulation',
|
|
206
|
-
'Not verifying lockout bypass via header manipulation (X-Forwarded-For)',
|
|
207
|
-
],
|
|
208
|
-
'file-upload': [
|
|
209
|
-
'Relying solely on the Content-Type header — trivially spoofed by attackers',
|
|
210
|
-
'Only testing common extensions — test double extensions, Unicode normalisation tricks',
|
|
211
|
-
'Not testing what happens when the virus scanner is bypassed by a partial/corrupt file',
|
|
212
|
-
'Forgetting to test the download/serve path for path traversal',
|
|
213
|
-
],
|
|
214
|
-
generic: [
|
|
215
|
-
'Automated scanning without manual follow-up — scanners have high false-negative rates for logic flaws',
|
|
216
|
-
'Testing in a staging environment that differs significantly from production',
|
|
217
|
-
'Not scoping the test clearly — risk of legal exposure if boundaries are unclear',
|
|
218
|
-
'Producing findings without risk-ranked remediation guidance',
|
|
219
|
-
],
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
const PATTERNS: Record<SystemType, string[]> = {
|
|
223
|
-
'web-api': ['OWASP API Security Top 10', 'BOLA/IDOR testing matrix', 'Burp Suite active scan + manual auth testing'],
|
|
224
|
-
'web-frontend': ['OWASP Testing Guide — Client-Side Testing', 'CSP evaluation methodology', 'Browser-based XSS polyglot testing'],
|
|
225
|
-
'auth-system': ['OWASP Authentication Cheat Sheet verification', 'Session token entropy analysis', 'Timing attack measurement with wrk/hey'],
|
|
226
|
-
'file-upload': ['OWASP File Upload Cheat Sheet', 'Magic-byte bypass library (file-type npm)', 'Zip slip detection via extraction simulation'],
|
|
227
|
-
generic: ['OWASP Testing Guide v4', 'PTES (Penetration Testing Execution Standard)', 'CVSSv3.1 severity scoring'],
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// ─── Public API ────────────────────────────────────────────────────────────
|
|
231
|
-
|
|
232
|
-
export function plan(task: string, context?: string): AgentPlan {
|
|
233
|
-
const systemType = detectSystemType(task);
|
|
234
|
-
|
|
235
|
-
const tierMap: Record<SystemType, 1 | 2 | 3> = {
|
|
236
|
-
'web-api': 3,
|
|
237
|
-
'web-frontend': 2,
|
|
238
|
-
'auth-system': 3,
|
|
239
|
-
'file-upload': 2,
|
|
240
|
-
generic: 3,
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
const durationMap: Record<SystemType, string> = {
|
|
244
|
-
'web-api': '1-2 days',
|
|
245
|
-
'web-frontend': '4-8 hours',
|
|
246
|
-
'auth-system': '1-2 days',
|
|
247
|
-
'file-upload': '4-6 hours',
|
|
248
|
-
generic: '3-5 days',
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
return {
|
|
252
|
-
agent: 'penetration',
|
|
253
|
-
task,
|
|
254
|
-
tier: tierMap[systemType],
|
|
255
|
-
approach: APPROACH[systemType],
|
|
256
|
-
steps: STEPS[systemType],
|
|
257
|
-
checklist: CHECKLIST[systemType],
|
|
258
|
-
pitfalls: PITFALLS[systemType],
|
|
259
|
-
patterns: PATTERNS[systemType],
|
|
260
|
-
duration_estimate: context?.includes('full-scope') ? '5-10 days' : durationMap[systemType],
|
|
261
|
-
};
|
|
262
|
-
}
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import type { AgentPlan } from '../types.js';
|
|
2
|
-
|
|
3
|
-
// ─── Data-type detection ───────────────────────────────────────────────────
|
|
4
|
-
|
|
5
|
-
type PrivacyScenario =
|
|
6
|
-
| 'registration'
|
|
7
|
-
| 'analytics'
|
|
8
|
-
| 'export'
|
|
9
|
-
| 'deletion'
|
|
10
|
-
| 'third-party'
|
|
11
|
-
| 'general';
|
|
12
|
-
|
|
13
|
-
function detectScenario(task: string): PrivacyScenario {
|
|
14
|
-
const t = task.toLowerCase();
|
|
15
|
-
if (/\bregist(?:er|ration)\b|sign[\s-]?up|create\s+account/.test(t)) return 'registration';
|
|
16
|
-
if (/\banalytics\b|tracking|telemetry|metrics|pageview/.test(t)) return 'analytics';
|
|
17
|
-
if (/\bexport\b|download\s+data|portability|data\s+request/.test(t)) return 'export';
|
|
18
|
-
if (/\bdelet(?:e|ion)\b|right\s+to\s+erasure|forget|purge|wipe/.test(t)) return 'deletion';
|
|
19
|
-
if (/\bthird[\s-]?party\b|integration|external\s+service|vendor|processor/.test(t)) return 'third-party';
|
|
20
|
-
return 'general';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// ─── Approach map ──────────────────────────────────────────────────────────
|
|
24
|
-
|
|
25
|
-
const APPROACH: Record<PrivacyScenario, string> = {
|
|
26
|
-
registration:
|
|
27
|
-
'Collect only the minimum data required for registration. Obtain informed, granular consent before processing. Apply retention limits from day one.',
|
|
28
|
-
analytics:
|
|
29
|
-
'Implement privacy-by-default analytics: anonymise IPs, honour Do-Not-Track, provide opt-out, and avoid cross-site tracking.',
|
|
30
|
-
export:
|
|
31
|
-
'Implement the right to data portability: deliver all user data in a machine-readable format within the required time window.',
|
|
32
|
-
deletion:
|
|
33
|
-
'Implement the right to erasure: permanently delete or anonymise all user data, including backups and third-party processor copies, within 30 days.',
|
|
34
|
-
'third-party':
|
|
35
|
-
'Ensure all third-party data processors have a signed Data Processing Agreement (DPA) and adequate safeguards for data transfers.',
|
|
36
|
-
general:
|
|
37
|
-
'Apply GDPR/CCPA privacy principles: lawfulness, fairness, transparency, purpose limitation, data minimisation, accuracy, storage limits, integrity, and accountability.',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// ─── Steps map ────────────────────────────────────────────────────────────
|
|
41
|
-
|
|
42
|
-
const STEPS: Record<PrivacyScenario, string[]> = {
|
|
43
|
-
registration: [
|
|
44
|
-
'Define the legal basis for processing each data field (consent, contract, legitimate interest)',
|
|
45
|
-
'Present a clear, plain-language consent form with separate opt-ins per purpose',
|
|
46
|
-
'Collect only fields strictly necessary for the service (data minimisation)',
|
|
47
|
-
'Set retention period per data category in the data inventory',
|
|
48
|
-
'Implement double opt-in for marketing communications',
|
|
49
|
-
'Store consent record with timestamp, version, and IP',
|
|
50
|
-
'Link to privacy policy and cookie policy at registration',
|
|
51
|
-
'Provide account settings to update or withdraw consent',
|
|
52
|
-
'Trigger automated data deletion or anonymisation at retention expiry',
|
|
53
|
-
],
|
|
54
|
-
analytics: [
|
|
55
|
-
'Audit all analytics scripts for third-party data sharing',
|
|
56
|
-
'Implement consent management platform (CMP) with granular cookie categories',
|
|
57
|
-
'Block analytics scripts until consent is granted',
|
|
58
|
-
'Anonymise IP addresses before sending to analytics provider (e.g., GA anonymizeIp)',
|
|
59
|
-
'Set analytics data retention to minimum required (e.g., 14 months max)',
|
|
60
|
-
'Honour Do-Not-Track (DNT) header in custom analytics code',
|
|
61
|
-
'Provide a clear opt-out mechanism accessible from every page',
|
|
62
|
-
'Avoid fingerprinting techniques (canvas, audio, font enumeration)',
|
|
63
|
-
'Test that analytics is inactive until consent is recorded',
|
|
64
|
-
],
|
|
65
|
-
export: [
|
|
66
|
-
'Identify all data stores that contain user-specific data',
|
|
67
|
-
'Build an aggregation service that joins all user data from each store',
|
|
68
|
-
'Output data in a machine-readable format: JSON or CSV minimum',
|
|
69
|
-
'Respond to export requests within 30 days (GDPR) or 45 days (CCPA)',
|
|
70
|
-
"Verify the requesting user's identity before delivering the export",
|
|
71
|
-
'Deliver export via secure, time-limited download link (not email attachment)',
|
|
72
|
-
'Log export requests with timestamp and requester identity',
|
|
73
|
-
'Include a data dictionary explaining each exported field',
|
|
74
|
-
],
|
|
75
|
-
deletion: [
|
|
76
|
-
'Map all tables and data stores that hold user data (data map)',
|
|
77
|
-
'Implement cascade delete from user ID across all related tables',
|
|
78
|
-
'Replace user identifiers in analytics/log records with anonymous placeholder',
|
|
79
|
-
'Submit deletion requests to all third-party processors within 7 days',
|
|
80
|
-
'Schedule purge of backups containing user data within the backup retention period',
|
|
81
|
-
'Verify user identity before processing deletion request',
|
|
82
|
-
'Send confirmation email once deletion is complete',
|
|
83
|
-
'Log deletion requests and completion timestamps for regulatory records',
|
|
84
|
-
'Test that no user data remains accessible after deletion via API or DB query',
|
|
85
|
-
],
|
|
86
|
-
'third-party': [
|
|
87
|
-
'Maintain an inventory of all third-party data processors and sub-processors',
|
|
88
|
-
'Obtain a signed Data Processing Agreement (DPA) from each processor',
|
|
89
|
-
'Verify that processors maintain adequate safeguards (SOC 2, ISO 27001, or SCCs for EU transfers)',
|
|
90
|
-
'Implement Standard Contractual Clauses (SCCs) for transfers outside the EEA',
|
|
91
|
-
'Minimise data shared with third parties to what they strictly require',
|
|
92
|
-
'Review processor sub-processor lists annually',
|
|
93
|
-
'Include processor list in the privacy policy',
|
|
94
|
-
'Implement contractual audit rights and breach notification obligations',
|
|
95
|
-
'Test that data deleted from primary store is also deleted from processors',
|
|
96
|
-
],
|
|
97
|
-
general: [
|
|
98
|
-
'Conduct a Data Protection Impact Assessment (DPIA) for high-risk processing',
|
|
99
|
-
'Appoint a Data Protection Officer (DPO) if required by scale or data type',
|
|
100
|
-
'Publish a clear, up-to-date privacy policy',
|
|
101
|
-
'Implement consent management for all non-essential processing',
|
|
102
|
-
'Maintain a Record of Processing Activities (RoPA)',
|
|
103
|
-
'Define and enforce data retention periods per category',
|
|
104
|
-
'Implement all data subject rights: access, rectification, erasure, portability, objection',
|
|
105
|
-
'Establish a breach notification procedure (72-hour GDPR window)',
|
|
106
|
-
'Conduct annual privacy training for all staff who handle personal data',
|
|
107
|
-
],
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// ─── Checklist map ────────────────────────────────────────────────────────
|
|
111
|
-
|
|
112
|
-
const CHECKLIST: Record<PrivacyScenario, string[]> = {
|
|
113
|
-
registration: [
|
|
114
|
-
'Consent is explicit, granular, and obtained before processing starts',
|
|
115
|
-
'Consent record stored with timestamp, version, and IP address',
|
|
116
|
-
'Only fields necessary for the stated purpose are collected',
|
|
117
|
-
'Privacy policy linked at registration with plain-language summary',
|
|
118
|
-
'Marketing opt-in is a separate, unchecked checkbox',
|
|
119
|
-
'Double opt-in implemented for email marketing',
|
|
120
|
-
'Retention period defined and enforced for each data category',
|
|
121
|
-
'Automated deletion or anonymisation triggered at retention expiry',
|
|
122
|
-
'Users can view and withdraw consent from their account settings',
|
|
123
|
-
'Data breach notification procedure documented and tested',
|
|
124
|
-
'DPIA conducted if processing sensitive categories of data',
|
|
125
|
-
'Sub-processors listed in privacy policy',
|
|
126
|
-
],
|
|
127
|
-
analytics: [
|
|
128
|
-
'Consent management platform (CMP) implemented and tested',
|
|
129
|
-
'Analytics scripts blocked until explicit consent is granted',
|
|
130
|
-
'IP addresses anonymised before transmission to analytics provider',
|
|
131
|
-
'Analytics data retention set to 14 months maximum',
|
|
132
|
-
'Do-Not-Track (DNT) header honoured in custom scripts',
|
|
133
|
-
'Clear opt-out link present on every page',
|
|
134
|
-
'No cross-site tracking (third-party cookies) without separate consent',
|
|
135
|
-
'Analytics vendor DPA signed and stored',
|
|
136
|
-
'Cookie audit performed; no undisclosed cookies present',
|
|
137
|
-
'Privacy policy updated to list analytics cookies and their purpose',
|
|
138
|
-
'Users can withdraw analytics consent and data is not collected retroactively',
|
|
139
|
-
'Fingerprinting techniques absent from the codebase',
|
|
140
|
-
],
|
|
141
|
-
export: [
|
|
142
|
-
'All user data stores identified and included in export',
|
|
143
|
-
'Export generated within 30 days of verified request',
|
|
144
|
-
'Identity verification required before export delivery',
|
|
145
|
-
'Export delivered via secure, time-limited download link',
|
|
146
|
-
'Export format is machine-readable (JSON/CSV)',
|
|
147
|
-
'Data dictionary included explaining each field',
|
|
148
|
-
'Export request and delivery logged with timestamp',
|
|
149
|
-
'Export excludes data about third parties embedded in user records',
|
|
150
|
-
'Large exports split into manageable archive files',
|
|
151
|
-
'Automated end-to-end test confirms export completeness',
|
|
152
|
-
'Privacy policy describes the export right and the request process',
|
|
153
|
-
'Requests acknowledged within 72 hours even if processing takes longer',
|
|
154
|
-
],
|
|
155
|
-
deletion: [
|
|
156
|
-
'All data stores with user data identified in the data map',
|
|
157
|
-
'Cascade delete implemented across all related tables',
|
|
158
|
-
'Analytics and log records anonymised (not deleted) to preserve aggregate stats',
|
|
159
|
-
'Third-party processors notified within 7 days',
|
|
160
|
-
'Backup purge scheduled within backup retention window',
|
|
161
|
-
'Identity verification required before deletion is processed',
|
|
162
|
-
'Confirmation email sent to user on completion',
|
|
163
|
-
'Deletion request and completion timestamp logged',
|
|
164
|
-
'Automated test verifies no user data accessible after deletion',
|
|
165
|
-
'Right to erasure exceptions documented (legal hold, fraud prevention)',
|
|
166
|
-
'Privacy policy explains erasure right and any applicable exceptions',
|
|
167
|
-
'Requests processed within 30-day GDPR statutory window',
|
|
168
|
-
],
|
|
169
|
-
'third-party': [
|
|
170
|
-
'Data processor inventory maintained and kept current',
|
|
171
|
-
'Signed DPA on file for every processor',
|
|
172
|
-
'SCCs in place for transfers outside the EEA',
|
|
173
|
-
'Sub-processor list published in privacy policy',
|
|
174
|
-
'Data minimisation applied to third-party data shares',
|
|
175
|
-
'Processors audited annually (questionnaire or certification review)',
|
|
176
|
-
'Breach notification clause in every DPA (72-hour escalation)',
|
|
177
|
-
'Audit rights clause in every DPA',
|
|
178
|
-
'Processors instructed to delete data on contract termination',
|
|
179
|
-
'Third-party scripts reviewed for unexpected data collection',
|
|
180
|
-
'Privacy policy updated when new processors are added',
|
|
181
|
-
'DPIA updated when new high-risk processors are engaged',
|
|
182
|
-
],
|
|
183
|
-
general: [
|
|
184
|
-
'Data Protection Impact Assessment (DPIA) completed for high-risk processing',
|
|
185
|
-
'Record of Processing Activities (RoPA) maintained and current',
|
|
186
|
-
'Privacy policy published, accurate, and written in plain language',
|
|
187
|
-
'Consent mechanism implemented for all non-essential processing',
|
|
188
|
-
'All six data subject rights implemented: access, rectification, erasure, restriction, portability, objection',
|
|
189
|
-
'Breach notification procedure tested (72-hour GDPR window)',
|
|
190
|
-
'Data retention periods defined and automated enforcement in place',
|
|
191
|
-
'Staff privacy training conducted annually',
|
|
192
|
-
'DPO appointed if required; contact details published',
|
|
193
|
-
'Privacy-by-design documented in system architecture decisions',
|
|
194
|
-
'Cookie banner compliant: no pre-ticked boxes, easy to reject',
|
|
195
|
-
'CCPA opt-out of sale link present if applicable',
|
|
196
|
-
"Children's data (under 16) not collected without parental consent",
|
|
197
|
-
'Sensitive data categories (health, biometric, etc.) identified and protected with additional safeguards',
|
|
198
|
-
],
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// ─── Pitfall and pattern maps ─────────────────────────────────────────────
|
|
202
|
-
|
|
203
|
-
const PITFALLS: Record<PrivacyScenario, string[]> = {
|
|
204
|
-
registration: [
|
|
205
|
-
'Pre-ticking marketing consent checkboxes — invalid consent under GDPR',
|
|
206
|
-
'Bundling consent with terms of service — consent must be freely given and separate',
|
|
207
|
-
'Collecting date of birth without age verification logic',
|
|
208
|
-
'Not storing the consent record — cannot prove lawfulness later',
|
|
209
|
-
],
|
|
210
|
-
analytics: [
|
|
211
|
-
'Loading Google Analytics before consent — sets cookies and sends data illegally',
|
|
212
|
-
'Using analytics data for purposes not disclosed in the privacy policy',
|
|
213
|
-
'Treating analytics as "legitimate interest" without a balancing test',
|
|
214
|
-
'Not removing analytics data when a user opts out retrospectively',
|
|
215
|
-
],
|
|
216
|
-
export: [
|
|
217
|
-
'Sending export to the wrong email address — data breach',
|
|
218
|
-
"Including other users' data in the export (e.g., shared records)",
|
|
219
|
-
'Generating the export synchronously — times out for large accounts',
|
|
220
|
-
'Omitting data held in third-party processors from the export',
|
|
221
|
-
],
|
|
222
|
-
deletion: [
|
|
223
|
-
'Deleting user record but leaving orphaned rows in related tables',
|
|
224
|
-
'Not deleting from search indexes and caches',
|
|
225
|
-
'Forgetting to notify third-party processors',
|
|
226
|
-
'Treating deletion and anonymisation as equivalent without considering the re-identification risk',
|
|
227
|
-
],
|
|
228
|
-
'third-party': [
|
|
229
|
-
'Assuming cloud providers (AWS, GCP) are automatically GDPR-compliant — SCCs still required for US data transfers',
|
|
230
|
-
'Not reviewing sub-processor lists — processors may engage additional parties',
|
|
231
|
-
'Sharing more user data than the processor needs',
|
|
232
|
-
'Failing to update the privacy policy when onboarding new processors',
|
|
233
|
-
],
|
|
234
|
-
general: [
|
|
235
|
-
'Treating GDPR as a one-time compliance project rather than an ongoing process',
|
|
236
|
-
'Using legitimate interest as a catch-all basis without a documented balancing test',
|
|
237
|
-
'Ignoring CCPA if users are based in California but company is not US-registered',
|
|
238
|
-
'Not having a documented response procedure for data subject requests',
|
|
239
|
-
],
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
const PATTERNS: Record<PrivacyScenario, string[]> = {
|
|
243
|
-
registration: ['Consent-first data collection', 'Data minimisation at source', 'Retention-period-as-code'],
|
|
244
|
-
analytics: ['Consent-gated script loading', 'Privacy-preserving analytics (server-side aggregation)', 'Opt-out-first design'],
|
|
245
|
-
export: ['Async export job with secure delivery', 'Data aggregation service pattern', 'Identity verification before sensitive operations'],
|
|
246
|
-
deletion: ['Cascade delete with audit trail', 'Anonymisation as delete alternative for analytics', 'Third-party propagation queue'],
|
|
247
|
-
'third-party': ['Processor register with DPA tracking', 'Data minimisation at integration boundary', 'Contractual breach escalation chain'],
|
|
248
|
-
general: ['Privacy by design and by default', 'Data subject rights as first-class API endpoints', 'DPIA for high-risk processing decisions'],
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
// ─── Public API ────────────────────────────────────────────────────────────
|
|
252
|
-
|
|
253
|
-
export function plan(task: string, context?: string): AgentPlan {
|
|
254
|
-
const scenario = detectScenario(task);
|
|
255
|
-
|
|
256
|
-
const tierMap: Record<PrivacyScenario, 1 | 2 | 3> = {
|
|
257
|
-
registration: 2,
|
|
258
|
-
analytics: 2,
|
|
259
|
-
export: 2,
|
|
260
|
-
deletion: 2,
|
|
261
|
-
'third-party': 3,
|
|
262
|
-
general: 1,
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
const durationMap: Record<PrivacyScenario, string> = {
|
|
266
|
-
registration: '3-5 hours',
|
|
267
|
-
analytics: '2-4 hours',
|
|
268
|
-
export: '4-6 hours',
|
|
269
|
-
deletion: '4-8 hours',
|
|
270
|
-
'third-party': '6-10 hours',
|
|
271
|
-
general: '2-3 hours',
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
return {
|
|
275
|
-
agent: 'privacy',
|
|
276
|
-
task,
|
|
277
|
-
tier: tierMap[scenario],
|
|
278
|
-
approach: APPROACH[scenario],
|
|
279
|
-
steps: STEPS[scenario],
|
|
280
|
-
checklist: CHECKLIST[scenario],
|
|
281
|
-
pitfalls: PITFALLS[scenario],
|
|
282
|
-
patterns: PATTERNS[scenario],
|
|
283
|
-
duration_estimate: context?.includes('enterprise') ? '2-4 weeks' : durationMap[scenario],
|
|
284
|
-
};
|
|
285
|
-
}
|