opena2a-cli 0.1.2 → 0.3.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 +225 -1
- package/dist/commands/guard-hooks.d.ts +27 -0
- package/dist/commands/guard-hooks.d.ts.map +1 -0
- package/dist/commands/guard-hooks.js +207 -0
- package/dist/commands/guard-hooks.js.map +1 -0
- package/dist/commands/guard-policy.d.ts +54 -0
- package/dist/commands/guard-policy.d.ts.map +1 -0
- package/dist/commands/guard-policy.js +251 -0
- package/dist/commands/guard-policy.js.map +1 -0
- package/dist/commands/guard-signing.d.ts +52 -0
- package/dist/commands/guard-signing.d.ts.map +1 -0
- package/dist/commands/guard-signing.js +185 -0
- package/dist/commands/guard-signing.js.map +1 -0
- package/dist/commands/guard-snapshots.d.ts +54 -0
- package/dist/commands/guard-snapshots.d.ts.map +1 -0
- package/dist/commands/guard-snapshots.js +346 -0
- package/dist/commands/guard-snapshots.js.map +1 -0
- package/dist/commands/guard.d.ts +60 -4
- package/dist/commands/guard.d.ts.map +1 -1
- package/dist/commands/guard.js +475 -95
- package/dist/commands/guard.js.map +1 -1
- package/dist/commands/init.js +3 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/review.d.ts +110 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +634 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/shield.d.ts +3 -0
- package/dist/commands/shield.d.ts.map +1 -1
- package/dist/commands/shield.js +488 -34
- package/dist/commands/shield.js.map +1 -1
- package/dist/index.js +36 -6
- package/dist/index.js.map +1 -1
- package/dist/report/review-html.d.ts +16 -0
- package/dist/report/review-html.d.ts.map +1 -0
- package/dist/report/review-html.js +579 -0
- package/dist/report/review-html.js.map +1 -0
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +2 -1
- package/dist/router.js.map +1 -1
- package/dist/shield/ai-tool-config.d.ts +49 -0
- package/dist/shield/ai-tool-config.d.ts.map +1 -0
- package/dist/shield/ai-tool-config.js +169 -0
- package/dist/shield/ai-tool-config.js.map +1 -0
- package/dist/shield/arp-bridge.d.ts +62 -0
- package/dist/shield/arp-bridge.d.ts.map +1 -0
- package/dist/shield/arp-bridge.js +198 -0
- package/dist/shield/arp-bridge.js.map +1 -0
- package/dist/shield/baselines.d.ts +58 -0
- package/dist/shield/baselines.d.ts.map +1 -0
- package/dist/shield/baselines.js +371 -0
- package/dist/shield/baselines.js.map +1 -0
- package/dist/shield/findings.d.ts +52 -0
- package/dist/shield/findings.d.ts.map +1 -0
- package/dist/shield/findings.js +336 -0
- package/dist/shield/findings.js.map +1 -0
- package/dist/shield/init.d.ts +3 -0
- package/dist/shield/init.d.ts.map +1 -1
- package/dist/shield/init.js +145 -12
- package/dist/shield/init.js.map +1 -1
- package/dist/shield/integrity.d.ts.map +1 -1
- package/dist/shield/integrity.js +6 -2
- package/dist/shield/integrity.js.map +1 -1
- package/dist/shield/report-html.d.ts +29 -0
- package/dist/shield/report-html.d.ts.map +1 -0
- package/dist/shield/report-html.js +689 -0
- package/dist/shield/report-html.js.map +1 -0
- package/dist/shield/sarif.d.ts +65 -0
- package/dist/shield/sarif.d.ts.map +1 -0
- package/dist/shield/sarif.js +108 -0
- package/dist/shield/sarif.js.map +1 -0
- package/dist/shield/status.d.ts.map +1 -1
- package/dist/shield/status.js +19 -6
- package/dist/shield/status.js.map +1 -1
- package/dist/shield/types.d.ts +19 -1
- package/dist/shield/types.d.ts.map +1 -1
- package/dist/shield/types.js +2 -1
- package/dist/shield/types.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shield Finding Taxonomy and Classification Engine.
|
|
4
|
+
*
|
|
5
|
+
* Maps Shield events to standardized finding IDs with:
|
|
6
|
+
* - OWASP Agentic Security Index (ASI) compliance references
|
|
7
|
+
* - MITRE ATLAS technique references
|
|
8
|
+
* - Actionable remediation commands
|
|
9
|
+
* - Severity classification
|
|
10
|
+
*
|
|
11
|
+
* Finding ID format: SHIELD-{CATEGORY}-{NUMBER}
|
|
12
|
+
* Categories: CRED (credential), POL (policy), PROC (process/runtime),
|
|
13
|
+
* INT (integrity), SUP (supply chain), BAS (behavioral)
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.FINDING_CATALOG = void 0;
|
|
17
|
+
exports.classifyEvent = classifyEvent;
|
|
18
|
+
exports.classifyEvents = classifyEvents;
|
|
19
|
+
exports.classifyViolation = classifyViolation;
|
|
20
|
+
exports.getRemediation = getRemediation;
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Finding Catalog
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
exports.FINDING_CATALOG = {
|
|
25
|
+
'SHIELD-CRED-001': {
|
|
26
|
+
id: 'SHIELD-CRED-001',
|
|
27
|
+
title: 'Anthropic API key exposed in source',
|
|
28
|
+
severity: 'critical',
|
|
29
|
+
category: 'cred',
|
|
30
|
+
owaspAgentic: 'ASI04',
|
|
31
|
+
mitreAtlas: 'AML.T0025',
|
|
32
|
+
remediation: 'opena2a protect --dir . && git filter-repo --path <file> --invert-paths',
|
|
33
|
+
description: 'An Anthropic API key was found hardcoded in source files. This key grants full API access and can result in unauthorized billing.',
|
|
34
|
+
},
|
|
35
|
+
'SHIELD-CRED-002': {
|
|
36
|
+
id: 'SHIELD-CRED-002',
|
|
37
|
+
title: 'OpenAI API key exposed in source',
|
|
38
|
+
severity: 'critical',
|
|
39
|
+
category: 'cred',
|
|
40
|
+
owaspAgentic: 'ASI04',
|
|
41
|
+
mitreAtlas: 'AML.T0025',
|
|
42
|
+
remediation: 'opena2a protect --dir . && git filter-repo --path <file> --invert-paths',
|
|
43
|
+
description: 'An OpenAI API key was found hardcoded in source files. Exposed keys are exploited within minutes of public disclosure.',
|
|
44
|
+
},
|
|
45
|
+
'SHIELD-CRED-003': {
|
|
46
|
+
id: 'SHIELD-CRED-003',
|
|
47
|
+
title: 'GitHub token exposed in source',
|
|
48
|
+
severity: 'high',
|
|
49
|
+
category: 'cred',
|
|
50
|
+
owaspAgentic: 'ASI04',
|
|
51
|
+
mitreAtlas: 'AML.T0025',
|
|
52
|
+
remediation: 'opena2a protect --dir . && gh auth refresh',
|
|
53
|
+
description: 'A GitHub token was found hardcoded in source files. This token may grant repository access including private repos and org resources.',
|
|
54
|
+
},
|
|
55
|
+
'SHIELD-CRED-004': {
|
|
56
|
+
id: 'SHIELD-CRED-004',
|
|
57
|
+
title: 'Generic API key or secret exposed',
|
|
58
|
+
severity: 'medium',
|
|
59
|
+
category: 'cred',
|
|
60
|
+
owaspAgentic: 'ASI04',
|
|
61
|
+
mitreAtlas: 'AML.T0025',
|
|
62
|
+
remediation: 'opena2a protect --dir .',
|
|
63
|
+
description: 'A generic API key or secret was found in a variable assignment. Move it to environment variables or a secrets manager.',
|
|
64
|
+
},
|
|
65
|
+
'SHIELD-POL-001': {
|
|
66
|
+
id: 'SHIELD-POL-001',
|
|
67
|
+
title: 'No security policy defined',
|
|
68
|
+
severity: 'high',
|
|
69
|
+
category: 'pol',
|
|
70
|
+
owaspAgentic: 'ASI03',
|
|
71
|
+
mitreAtlas: 'AML.T0040',
|
|
72
|
+
remediation: 'opena2a shield init',
|
|
73
|
+
description: 'No Shield security policy is configured. Without a policy, all agent actions are unmonitored and unrestricted.',
|
|
74
|
+
},
|
|
75
|
+
'SHIELD-POL-002': {
|
|
76
|
+
id: 'SHIELD-POL-002',
|
|
77
|
+
title: 'Policy violation -- action blocked',
|
|
78
|
+
severity: 'high',
|
|
79
|
+
category: 'pol',
|
|
80
|
+
owaspAgentic: 'ASI02',
|
|
81
|
+
mitreAtlas: 'AML.T0040',
|
|
82
|
+
remediation: 'opena2a shield policy',
|
|
83
|
+
description: 'An agent action was blocked by the security policy. Review the policy to confirm the block is intentional or adjust rules.',
|
|
84
|
+
},
|
|
85
|
+
'SHIELD-POL-003': {
|
|
86
|
+
id: 'SHIELD-POL-003',
|
|
87
|
+
title: 'Policy in monitor-only mode',
|
|
88
|
+
severity: 'medium',
|
|
89
|
+
category: 'pol',
|
|
90
|
+
owaspAgentic: 'ASI03',
|
|
91
|
+
mitreAtlas: 'AML.T0040',
|
|
92
|
+
remediation: 'opena2a shield policy --enforce',
|
|
93
|
+
description: 'The security policy is in monitor-only mode. Violations are logged but not blocked. Consider enabling enforcement.',
|
|
94
|
+
},
|
|
95
|
+
'SHIELD-PROC-001': {
|
|
96
|
+
id: 'SHIELD-PROC-001',
|
|
97
|
+
title: 'Suspicious process spawned by agent',
|
|
98
|
+
severity: 'high',
|
|
99
|
+
category: 'proc',
|
|
100
|
+
owaspAgentic: 'ASI05',
|
|
101
|
+
mitreAtlas: 'AML.T0006',
|
|
102
|
+
remediation: 'opena2a shield evaluate --action process.spawn --target <binary>',
|
|
103
|
+
description: 'An AI agent spawned a process that was flagged as suspicious by the runtime protection engine.',
|
|
104
|
+
},
|
|
105
|
+
'SHIELD-PROC-002': {
|
|
106
|
+
id: 'SHIELD-PROC-002',
|
|
107
|
+
title: 'Network connection anomaly detected',
|
|
108
|
+
severity: 'medium',
|
|
109
|
+
category: 'proc',
|
|
110
|
+
owaspAgentic: 'ASI07',
|
|
111
|
+
mitreAtlas: 'AML.T0007',
|
|
112
|
+
remediation: 'opena2a shield evaluate --action network.connect --target <host>',
|
|
113
|
+
description: 'An anomalous network connection was made by an AI agent. This may indicate data exfiltration or C2 communication.',
|
|
114
|
+
},
|
|
115
|
+
'SHIELD-INT-001': {
|
|
116
|
+
id: 'SHIELD-INT-001',
|
|
117
|
+
title: 'Configuration file tampered',
|
|
118
|
+
severity: 'critical',
|
|
119
|
+
category: 'int',
|
|
120
|
+
owaspAgentic: 'ASI10',
|
|
121
|
+
mitreAtlas: 'AML.T0011',
|
|
122
|
+
remediation: 'opena2a guard diff && opena2a guard resign',
|
|
123
|
+
description: 'A monitored configuration file has been modified without authorization. The file signature no longer matches the stored hash.',
|
|
124
|
+
},
|
|
125
|
+
'SHIELD-INT-002': {
|
|
126
|
+
id: 'SHIELD-INT-002',
|
|
127
|
+
title: 'Event hash chain integrity broken',
|
|
128
|
+
severity: 'critical',
|
|
129
|
+
category: 'int',
|
|
130
|
+
owaspAgentic: 'ASI10',
|
|
131
|
+
mitreAtlas: 'AML.T0006',
|
|
132
|
+
remediation: 'opena2a shield selfcheck && opena2a shield recover --forensic',
|
|
133
|
+
description: 'The tamper-evident event log hash chain has been broken. This indicates log tampering or corruption.',
|
|
134
|
+
},
|
|
135
|
+
'SHIELD-INT-003': {
|
|
136
|
+
id: 'SHIELD-INT-003',
|
|
137
|
+
title: 'Configuration files not signed',
|
|
138
|
+
severity: 'medium',
|
|
139
|
+
category: 'int',
|
|
140
|
+
owaspAgentic: 'ASI09',
|
|
141
|
+
mitreAtlas: 'AML.T0011',
|
|
142
|
+
remediation: 'opena2a guard snapshot',
|
|
143
|
+
description: 'Monitored configuration files do not have cryptographic signatures. Enable ConfigGuard signing to detect unauthorized changes.',
|
|
144
|
+
},
|
|
145
|
+
'SHIELD-SUP-001': {
|
|
146
|
+
id: 'SHIELD-SUP-001',
|
|
147
|
+
title: 'Security advisory found in dependency',
|
|
148
|
+
severity: 'high',
|
|
149
|
+
category: 'sup',
|
|
150
|
+
owaspAgentic: 'ASI04',
|
|
151
|
+
mitreAtlas: 'AML.T0024',
|
|
152
|
+
remediation: 'npm audit fix || go get -u <package>',
|
|
153
|
+
description: 'A known security vulnerability was found in an installed dependency. Update the package to a patched version.',
|
|
154
|
+
},
|
|
155
|
+
'SHIELD-SUP-002': {
|
|
156
|
+
id: 'SHIELD-SUP-002',
|
|
157
|
+
title: 'Low-trust package installed',
|
|
158
|
+
severity: 'medium',
|
|
159
|
+
category: 'sup',
|
|
160
|
+
owaspAgentic: 'ASI04',
|
|
161
|
+
mitreAtlas: 'AML.T0024',
|
|
162
|
+
remediation: 'opena2a registry check <package>',
|
|
163
|
+
description: 'A package with a low trust score was installed. Review the package for legitimacy before use in production.',
|
|
164
|
+
},
|
|
165
|
+
'SHIELD-BAS-001': {
|
|
166
|
+
id: 'SHIELD-BAS-001',
|
|
167
|
+
title: 'Behavioral anomaly detected',
|
|
168
|
+
severity: 'medium',
|
|
169
|
+
category: 'bas',
|
|
170
|
+
owaspAgentic: 'ASI10',
|
|
171
|
+
mitreAtlas: 'AML.T0043',
|
|
172
|
+
remediation: 'opena2a shield baseline --agent <agent>',
|
|
173
|
+
description: 'An agent exhibited behavior that deviates significantly from its established baseline. Review the agent activity log.',
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
// Classification Logic
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
/**
|
|
180
|
+
* Map a single Shield event to its finding definition.
|
|
181
|
+
* Returns null if the event does not match any known finding pattern.
|
|
182
|
+
*/
|
|
183
|
+
function classifyEvent(event) {
|
|
184
|
+
// Credential findings
|
|
185
|
+
if (event.source === 'secretless' || event.category === 'credential-finding') {
|
|
186
|
+
const target = (event.target ?? '').toLowerCase();
|
|
187
|
+
const action = (event.action ?? '').toLowerCase();
|
|
188
|
+
if (target.includes('anthropic') || action.includes('anthropic') ||
|
|
189
|
+
event.detail?.findingId === 'CRED-001') {
|
|
190
|
+
return exports.FINDING_CATALOG['SHIELD-CRED-001'];
|
|
191
|
+
}
|
|
192
|
+
if (target.includes('openai') || action.includes('openai') ||
|
|
193
|
+
event.detail?.findingId === 'CRED-002') {
|
|
194
|
+
return exports.FINDING_CATALOG['SHIELD-CRED-002'];
|
|
195
|
+
}
|
|
196
|
+
if (target.includes('github') || action.includes('github') ||
|
|
197
|
+
event.detail?.findingId === 'CRED-003') {
|
|
198
|
+
return exports.FINDING_CATALOG['SHIELD-CRED-003'];
|
|
199
|
+
}
|
|
200
|
+
// Generic credential
|
|
201
|
+
return exports.FINDING_CATALOG['SHIELD-CRED-004'];
|
|
202
|
+
}
|
|
203
|
+
// ConfigGuard integrity findings
|
|
204
|
+
if (event.source === 'configguard') {
|
|
205
|
+
if (event.outcome === 'blocked' || event.action === 'tamper-detected' ||
|
|
206
|
+
event.detail?.outcome === 'tampered') {
|
|
207
|
+
return exports.FINDING_CATALOG['SHIELD-INT-001'];
|
|
208
|
+
}
|
|
209
|
+
if (event.action === 'unsigned' || event.category === 'config-unsigned') {
|
|
210
|
+
return exports.FINDING_CATALOG['SHIELD-INT-003'];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Shield diagnostic events: only integrity failures are real findings.
|
|
214
|
+
// All other shield-source events (posture-assessment, credential-finding,
|
|
215
|
+
// shield.init, shield.posture, shield.credential) are internal scans.
|
|
216
|
+
if (event.source === 'shield') {
|
|
217
|
+
if (event.category === 'integrity' && event.severity === 'critical') {
|
|
218
|
+
return exports.FINDING_CATALOG['SHIELD-INT-002'];
|
|
219
|
+
}
|
|
220
|
+
return null; // All other shield events are diagnostic, not findings
|
|
221
|
+
}
|
|
222
|
+
// ARP runtime findings
|
|
223
|
+
if (event.source === 'arp') {
|
|
224
|
+
if (event.category === 'process.spawn' || event.category?.startsWith('process')) {
|
|
225
|
+
return exports.FINDING_CATALOG['SHIELD-PROC-001'];
|
|
226
|
+
}
|
|
227
|
+
if (event.category?.startsWith('network')) {
|
|
228
|
+
return exports.FINDING_CATALOG['SHIELD-PROC-002'];
|
|
229
|
+
}
|
|
230
|
+
if (event.category === 'anomaly' || event.category === 'behavioral-anomaly') {
|
|
231
|
+
return exports.FINDING_CATALOG['SHIELD-BAS-001'];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// Registry / supply chain findings
|
|
235
|
+
if (event.source === 'registry' || event.category?.includes('supply-chain')) {
|
|
236
|
+
if (event.severity === 'high' || event.severity === 'critical') {
|
|
237
|
+
return exports.FINDING_CATALOG['SHIELD-SUP-001'];
|
|
238
|
+
}
|
|
239
|
+
return exports.FINDING_CATALOG['SHIELD-SUP-002'];
|
|
240
|
+
}
|
|
241
|
+
// Policy findings
|
|
242
|
+
if (event.outcome === 'blocked') {
|
|
243
|
+
return exports.FINDING_CATALOG['SHIELD-POL-002'];
|
|
244
|
+
}
|
|
245
|
+
if (event.outcome === 'monitored' && (event.severity === 'high' || event.severity === 'critical')) {
|
|
246
|
+
return exports.FINDING_CATALOG['SHIELD-POL-003'];
|
|
247
|
+
}
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Classify a batch of events into deduplicated findings with counts.
|
|
252
|
+
* Returns findings sorted by severity (critical first), then by count.
|
|
253
|
+
*/
|
|
254
|
+
function classifyEvents(events) {
|
|
255
|
+
const map = new Map();
|
|
256
|
+
for (const event of events) {
|
|
257
|
+
const finding = classifyEvent(event);
|
|
258
|
+
if (!finding)
|
|
259
|
+
continue;
|
|
260
|
+
const existing = map.get(finding.id);
|
|
261
|
+
if (existing) {
|
|
262
|
+
existing.count += 1;
|
|
263
|
+
if (event.timestamp < existing.firstSeen)
|
|
264
|
+
existing.firstSeen = event.timestamp;
|
|
265
|
+
if (event.timestamp > existing.lastSeen)
|
|
266
|
+
existing.lastSeen = event.timestamp;
|
|
267
|
+
if (existing.examples.length < 3)
|
|
268
|
+
existing.examples.push(event);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
map.set(finding.id, {
|
|
272
|
+
finding,
|
|
273
|
+
count: 1,
|
|
274
|
+
firstSeen: event.timestamp,
|
|
275
|
+
lastSeen: event.timestamp,
|
|
276
|
+
examples: [event],
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const severityOrder = {
|
|
281
|
+
critical: 0, high: 1, medium: 2, low: 3, info: 4,
|
|
282
|
+
};
|
|
283
|
+
return Array.from(map.values()).sort((a, b) => {
|
|
284
|
+
const sevDiff = severityOrder[a.finding.severity] - severityOrder[b.finding.severity];
|
|
285
|
+
if (sevDiff !== 0)
|
|
286
|
+
return sevDiff;
|
|
287
|
+
return b.count - a.count;
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Map a PolicyViolation to a finding definition.
|
|
292
|
+
* Used to enrich violation data in reports.
|
|
293
|
+
*/
|
|
294
|
+
function classifyViolation(violation) {
|
|
295
|
+
const action = (violation.action ?? '').toLowerCase();
|
|
296
|
+
const target = (violation.target ?? '').toLowerCase();
|
|
297
|
+
// Credential-related violations
|
|
298
|
+
if (action.includes('credential') || action.includes('secret') || action.includes('key')) {
|
|
299
|
+
if (target.includes('anthropic'))
|
|
300
|
+
return exports.FINDING_CATALOG['SHIELD-CRED-001'];
|
|
301
|
+
if (target.includes('openai'))
|
|
302
|
+
return exports.FINDING_CATALOG['SHIELD-CRED-002'];
|
|
303
|
+
if (target.includes('github'))
|
|
304
|
+
return exports.FINDING_CATALOG['SHIELD-CRED-003'];
|
|
305
|
+
return exports.FINDING_CATALOG['SHIELD-CRED-004'];
|
|
306
|
+
}
|
|
307
|
+
// Process violations
|
|
308
|
+
if (action.includes('process') || action.includes('spawn') || action.includes('exec')) {
|
|
309
|
+
return exports.FINDING_CATALOG['SHIELD-PROC-001'];
|
|
310
|
+
}
|
|
311
|
+
// Network violations
|
|
312
|
+
if (action.includes('network') || action.includes('connect') || action.includes('http')) {
|
|
313
|
+
return exports.FINDING_CATALOG['SHIELD-PROC-002'];
|
|
314
|
+
}
|
|
315
|
+
// Config integrity violations
|
|
316
|
+
if (action.includes('config') || action.includes('tamper')) {
|
|
317
|
+
return exports.FINDING_CATALOG['SHIELD-INT-001'];
|
|
318
|
+
}
|
|
319
|
+
// Supply chain violations
|
|
320
|
+
if (action.includes('install') || action.includes('package') || action.includes('dependency')) {
|
|
321
|
+
return exports.FINDING_CATALOG['SHIELD-SUP-001'];
|
|
322
|
+
}
|
|
323
|
+
// Default: policy violation
|
|
324
|
+
if (violation.severity === 'critical' || violation.severity === 'high') {
|
|
325
|
+
return exports.FINDING_CATALOG['SHIELD-POL-002'];
|
|
326
|
+
}
|
|
327
|
+
return exports.FINDING_CATALOG['SHIELD-POL-003'];
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Get the remediation command for a finding ID.
|
|
331
|
+
*/
|
|
332
|
+
function getRemediation(findingId) {
|
|
333
|
+
const finding = exports.FINDING_CATALOG[findingId];
|
|
334
|
+
return finding?.remediation ?? 'opena2a shield selfcheck';
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=findings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.js","sourceRoot":"","sources":["../../src/shield/findings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAgMH,sCAyEC;AAMD,wCAiCC;AAMD,8CAqCC;AAKD,wCAGC;AAxUD,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAEjE,QAAA,eAAe,GAAsC;IAChE,iBAAiB,EAAE;QACjB,EAAE,EAAE,iBAAiB;QACrB,KAAK,EAAE,qCAAqC;QAC5C,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,MAAM;QAChB,YAAY,EAAE,OAAO;QACrB,UAAU,EAAE,WAAW;QACvB,WAAW,EAAE,yEAAyE;QACtF,WAAW,EAAE,mIAAmI;KACjJ;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,iBAAiB;QACrB,KAAK,EAAE,kCAAkC;QACzC,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,MAAM;QAChB,YAAY,EAAE,OAAO;QACrB,UAAU,EAAE,WAAW;QACvB,WAAW,EAAE,yEAAyE;QACtF,WAAW,EAAE,wHAAwH;KACtI;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,iBAAiB;QACrB,KAAK,EAAE,gCAAgC;QACvC,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,MAAM;QAChB,YAAY,EAAE,OAAO;QACrB,UAAU,EAAE,WAAW;QACvB,WAAW,EAAE,4CAA4C;QACzD,WAAW,EAAE,uIAAuI;KACrJ;IACD,iBAAiB,EAAE;QACjB,EA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Q,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3D,OAAO,uBAAe,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;IAED,0BAA0B;IAC1B,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9F,OAAO,uBAAe,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,SAAS,CAAC,QAAQ,KAAK,UAAU,IAAI,SAAS,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QACvE,OAAO,uBAAe,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,uBAAe,CAAC,gBAAgB,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,SAAiB;IAC9C,MAAM,OAAO,GAAG,uBAAe,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,OAAO,EAAE,WAAW,IAAI,0BAA0B,CAAC;AAC5D,CAAC"}
|
package/dist/shield/init.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/shield/init.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAKb,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/shield/init.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAKb,MAAM,YAAY,CAAC;AAYpB,UAAU,UAAU;IAClB,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC;CAChE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CA8XpD"}
|
package/dist/shield/init.js
CHANGED
|
@@ -10,6 +10,7 @@ const policy_js_1 = require("./policy.js");
|
|
|
10
10
|
const events_js_1 = require("./events.js");
|
|
11
11
|
const integrity_js_1 = require("./integrity.js");
|
|
12
12
|
const signing_js_1 = require("./signing.js");
|
|
13
|
+
const ai_tool_config_js_1 = require("./ai-tool-config.js");
|
|
13
14
|
const colors_js_1 = require("../util/colors.js");
|
|
14
15
|
const spinner_js_1 = require("../util/spinner.js");
|
|
15
16
|
async function shieldInit(options) {
|
|
@@ -84,9 +85,102 @@ async function shieldInit(options) {
|
|
|
84
85
|
steps.push({ name: 'Credential audit', status: credentialFindings > 0 ? 'warn' : 'done' });
|
|
85
86
|
if (isText)
|
|
86
87
|
process.stdout.write('\n');
|
|
87
|
-
// --- Step 3:
|
|
88
|
+
// --- Step 3: Credential Protection (Secretless) ---
|
|
88
89
|
if (isText)
|
|
89
|
-
process.stdout.write((0, colors_js_1.bold)('Step 3:
|
|
90
|
+
process.stdout.write((0, colors_js_1.bold)('Step 3: Credential Protection\n'));
|
|
91
|
+
let secretlessConfigured = false;
|
|
92
|
+
try {
|
|
93
|
+
const secretless = await import('secretless-ai');
|
|
94
|
+
if (typeof secretless.init === 'function') {
|
|
95
|
+
const result = secretless.init(targetDir);
|
|
96
|
+
secretlessConfigured = true;
|
|
97
|
+
if (isText) {
|
|
98
|
+
process.stdout.write((0, colors_js_1.green)(' Secretless configured\n'));
|
|
99
|
+
if (result && typeof result === 'object') {
|
|
100
|
+
if ('toolsConfigured' in result && Array.isArray(result.toolsConfigured)) {
|
|
101
|
+
process.stdout.write(` Tools: ${result.toolsConfigured.join(', ')}\n`);
|
|
102
|
+
}
|
|
103
|
+
if ('secretsFound' in result && typeof result.secretsFound === 'number' && result.secretsFound > 0) {
|
|
104
|
+
process.stdout.write(` Secrets protected: ${result.secretsFound}\n`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// Secretless module found but no init function -- try CLI fallback
|
|
111
|
+
secretlessConfigured = false;
|
|
112
|
+
if (isText)
|
|
113
|
+
process.stdout.write((0, colors_js_1.dim)(' Secretless module found but init not available\n'));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
if (isText) {
|
|
118
|
+
process.stdout.write((0, colors_js_1.dim)(' Secretless not installed (optional)\n'));
|
|
119
|
+
process.stdout.write((0, colors_js_1.dim)(' Install: npm install -g secretless-ai\n'));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
steps.push({ name: 'Credential protection', status: secretlessConfigured ? 'done' : 'skipped' });
|
|
123
|
+
if (isText)
|
|
124
|
+
process.stdout.write('\n');
|
|
125
|
+
// --- Step 4: Agent Identity (aim-core) ---
|
|
126
|
+
if (isText)
|
|
127
|
+
process.stdout.write((0, colors_js_1.bold)('Step 4: Agent Identity\n'));
|
|
128
|
+
let identityCreated = false;
|
|
129
|
+
let identityPublicKey = null;
|
|
130
|
+
try {
|
|
131
|
+
const aimCore = await import('@opena2a/aim-core');
|
|
132
|
+
if (typeof aimCore.getOrCreateIdentity === 'function') {
|
|
133
|
+
const identity = aimCore.getOrCreateIdentity({
|
|
134
|
+
agentName: 'shield',
|
|
135
|
+
dataDir: (0, node_path_1.join)((0, node_os_1.homedir)(), '.opena2a', 'aim-core'),
|
|
136
|
+
});
|
|
137
|
+
identityCreated = true;
|
|
138
|
+
if (identity && typeof identity === 'object' && 'publicKey' in identity) {
|
|
139
|
+
const pk = String(identity.publicKey);
|
|
140
|
+
identityPublicKey = pk.length > 16 ? pk.slice(0, 8) + '...' + pk.slice(-8) : pk;
|
|
141
|
+
}
|
|
142
|
+
if (isText) {
|
|
143
|
+
process.stdout.write((0, colors_js_1.green)(' Local Ed25519 identity ready\n'));
|
|
144
|
+
if (identityPublicKey) {
|
|
145
|
+
process.stdout.write(` Public key: ${identityPublicKey}\n`);
|
|
146
|
+
}
|
|
147
|
+
process.stdout.write(` Storage: ~/.opena2a/aim-core/\n`);
|
|
148
|
+
}
|
|
149
|
+
// Log identity event
|
|
150
|
+
if (typeof aimCore.logEvent === 'function') {
|
|
151
|
+
aimCore.logEvent({
|
|
152
|
+
type: 'shield.init',
|
|
153
|
+
agent: 'shield',
|
|
154
|
+
detail: { targetDir },
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else if (typeof aimCore.createIdentity === 'function') {
|
|
159
|
+
// Alternative API shape
|
|
160
|
+
const identity = aimCore.createIdentity('shield');
|
|
161
|
+
identityCreated = true;
|
|
162
|
+
if (isText) {
|
|
163
|
+
process.stdout.write((0, colors_js_1.green)(' Local Ed25519 identity created\n'));
|
|
164
|
+
process.stdout.write(` Storage: ~/.opena2a/aim-core/\n`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
if (isText)
|
|
169
|
+
process.stdout.write((0, colors_js_1.dim)(' aim-core module found but identity API not available\n'));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
if (isText) {
|
|
174
|
+
process.stdout.write((0, colors_js_1.dim)(' aim-core not installed (optional)\n'));
|
|
175
|
+
process.stdout.write((0, colors_js_1.dim)(' Install: npm install @opena2a/aim-core\n'));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
steps.push({ name: 'Agent identity', status: identityCreated ? 'done' : 'skipped' });
|
|
179
|
+
if (isText)
|
|
180
|
+
process.stdout.write('\n');
|
|
181
|
+
// --- Step 5: Config Integrity Baseline ---
|
|
182
|
+
if (isText)
|
|
183
|
+
process.stdout.write((0, colors_js_1.bold)('Step 5: Config Integrity Baseline\n'));
|
|
90
184
|
try {
|
|
91
185
|
const { guard } = await import('../commands/guard.js');
|
|
92
186
|
await guard({
|
|
@@ -107,9 +201,9 @@ async function shieldInit(options) {
|
|
|
107
201
|
}
|
|
108
202
|
if (isText)
|
|
109
203
|
process.stdout.write('\n');
|
|
110
|
-
// --- Step
|
|
204
|
+
// --- Step 6: Generate Policy ---
|
|
111
205
|
if (isText)
|
|
112
|
-
process.stdout.write((0, colors_js_1.bold)('Step
|
|
206
|
+
process.stdout.write((0, colors_js_1.bold)('Step 6: Generate Policy\n'));
|
|
113
207
|
const policy = (0, policy_js_1.generatePolicyFromScan)(scan);
|
|
114
208
|
const shieldDir = (0, events_js_1.getShieldDir)();
|
|
115
209
|
const policyPath = (0, node_path_1.join)(shieldDir, types_js_1.SHIELD_POLICY_FILE);
|
|
@@ -134,9 +228,9 @@ async function shieldInit(options) {
|
|
|
134
228
|
steps.push({ name: 'Policy generation', status: 'done' });
|
|
135
229
|
if (isText)
|
|
136
230
|
process.stdout.write('\n');
|
|
137
|
-
// --- Step
|
|
231
|
+
// --- Step 7: Shell Integration ---
|
|
138
232
|
if (isText)
|
|
139
|
-
process.stdout.write((0, colors_js_1.bold)('Step
|
|
233
|
+
process.stdout.write((0, colors_js_1.bold)('Step 7: Shell Integration\n'));
|
|
140
234
|
let shellHookInstalled = false;
|
|
141
235
|
const shell = process.env.SHELL?.includes('zsh') ? 'zsh'
|
|
142
236
|
: process.env.SHELL?.includes('bash') ? 'bash'
|
|
@@ -184,9 +278,9 @@ async function shieldInit(options) {
|
|
|
184
278
|
steps.push({ name: 'Shell integration', status: shellHookInstalled ? 'done' : 'skipped' });
|
|
185
279
|
if (isText)
|
|
186
280
|
process.stdout.write('\n');
|
|
187
|
-
// --- Step
|
|
281
|
+
// --- Step 8: ARP Initialization ---
|
|
188
282
|
if (isText)
|
|
189
|
-
process.stdout.write((0, colors_js_1.bold)('Step
|
|
283
|
+
process.stdout.write((0, colors_js_1.bold)('Step 8: Runtime Protection\n'));
|
|
190
284
|
try {
|
|
191
285
|
const { runtime } = await import('../commands/runtime.js');
|
|
192
286
|
await runtime({
|
|
@@ -207,9 +301,39 @@ async function shieldInit(options) {
|
|
|
207
301
|
}
|
|
208
302
|
if (isText)
|
|
209
303
|
process.stdout.write('\n');
|
|
210
|
-
// --- Step
|
|
304
|
+
// --- Step 9: AI Tool Configuration ---
|
|
305
|
+
if (isText)
|
|
306
|
+
process.stdout.write((0, colors_js_1.bold)('Step 9: AI Tool Configuration\n'));
|
|
307
|
+
let aiToolsConfigured = false;
|
|
308
|
+
let aiToolResult = null;
|
|
309
|
+
if (!ci) {
|
|
310
|
+
const detectedAssistants = scan.assistants
|
|
311
|
+
.filter((a) => a.detected)
|
|
312
|
+
.map((a) => a.name);
|
|
313
|
+
aiToolResult = (0, ai_tool_config_js_1.configureAiTools)(targetDir, detectedAssistants);
|
|
314
|
+
aiToolsConfigured = aiToolResult.toolsConfigured.length > 0;
|
|
315
|
+
if (isText) {
|
|
316
|
+
if (aiToolResult.toolsConfigured.length > 0) {
|
|
317
|
+
process.stdout.write((0, colors_js_1.green)(` Configured: ${aiToolResult.toolsConfigured.join(', ')}\n`));
|
|
318
|
+
}
|
|
319
|
+
if (aiToolResult.toolsSkipped.length > 0) {
|
|
320
|
+
process.stdout.write((0, colors_js_1.dim)(` Skipped: ${aiToolResult.toolsSkipped.join(', ')}\n`));
|
|
321
|
+
}
|
|
322
|
+
if (aiToolResult.toolsConfigured.length === 0 && aiToolResult.toolsSkipped.length === 0) {
|
|
323
|
+
process.stdout.write((0, colors_js_1.dim)(' No AI tools detected\n'));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
if (isText)
|
|
329
|
+
process.stdout.write((0, colors_js_1.dim)(' AI tool configuration skipped (CI mode)\n'));
|
|
330
|
+
}
|
|
331
|
+
steps.push({ name: 'AI tool config', status: aiToolsConfigured ? 'done' : 'skipped' });
|
|
332
|
+
if (isText)
|
|
333
|
+
process.stdout.write('\n');
|
|
334
|
+
// --- Step 10: Browser Guard ---
|
|
211
335
|
if (isText)
|
|
212
|
-
process.stdout.write((0, colors_js_1.bold)('Step
|
|
336
|
+
process.stdout.write((0, colors_js_1.bold)('Step 10: Browser Guard\n'));
|
|
213
337
|
const hasBrowserGuard = (0, node_fs_1.existsSync)((0, node_path_1.join)((0, node_os_1.homedir)(), '.config', 'opena2a', 'browser-guard.json')) ||
|
|
214
338
|
(0, node_fs_1.existsSync)((0, node_path_1.join)((0, node_os_1.homedir)(), '.opena2a', 'browser-guard.json'));
|
|
215
339
|
if (hasBrowserGuard) {
|
|
@@ -226,7 +350,7 @@ async function shieldInit(options) {
|
|
|
226
350
|
}
|
|
227
351
|
if (isText)
|
|
228
352
|
process.stdout.write('\n');
|
|
229
|
-
// --- Step
|
|
353
|
+
// --- Step 11: Summary ---
|
|
230
354
|
// Save scan results
|
|
231
355
|
const scanPath = (0, node_path_1.join)(shieldDir, types_js_1.SHIELD_SCAN_FILE);
|
|
232
356
|
(0, node_fs_1.writeFileSync)(scanPath, JSON.stringify(scan, null, 2) + '\n', { mode: 0o600 });
|
|
@@ -249,6 +373,9 @@ async function shieldInit(options) {
|
|
|
249
373
|
oauthSessions: scan.oauthSessions.filter((s) => s.hasActiveSession).length,
|
|
250
374
|
credentialFindings,
|
|
251
375
|
shellHookInstalled,
|
|
376
|
+
secretlessConfigured,
|
|
377
|
+
identityCreated,
|
|
378
|
+
aiToolsConfigured,
|
|
252
379
|
},
|
|
253
380
|
orgId: null,
|
|
254
381
|
managed: false,
|
|
@@ -256,12 +383,15 @@ async function shieldInit(options) {
|
|
|
256
383
|
});
|
|
257
384
|
steps.push({ name: 'Summary', status: 'done' });
|
|
258
385
|
if (isText) {
|
|
259
|
-
process.stdout.write((0, colors_js_1.bold)('Step
|
|
386
|
+
process.stdout.write((0, colors_js_1.bold)('Step 11: Summary\n'));
|
|
260
387
|
const doneCount = steps.filter(s => s.status === 'done').length;
|
|
261
388
|
const warnCount = steps.filter(s => s.status === 'warn').length;
|
|
389
|
+
const skippedCount = steps.filter(s => s.status === 'skipped').length;
|
|
262
390
|
process.stdout.write(` ${(0, colors_js_1.green)(`${doneCount} steps completed`)}`);
|
|
263
391
|
if (warnCount > 0)
|
|
264
392
|
process.stdout.write(`, ${(0, colors_js_1.yellow)(`${warnCount} warnings`)}`);
|
|
393
|
+
if (skippedCount > 0)
|
|
394
|
+
process.stdout.write(`, ${(0, colors_js_1.dim)(`${skippedCount} skipped`)}`);
|
|
265
395
|
process.stdout.write('\n');
|
|
266
396
|
process.stdout.write(` Policy: ${policyPath}\n`);
|
|
267
397
|
process.stdout.write(` Events: ${(0, node_path_1.join)(shieldDir, 'events.jsonl')}\n`);
|
|
@@ -279,6 +409,9 @@ async function shieldInit(options) {
|
|
|
279
409
|
policy,
|
|
280
410
|
shellHookInstalled,
|
|
281
411
|
policyPath,
|
|
412
|
+
secretlessConfigured,
|
|
413
|
+
identityCreated,
|
|
414
|
+
aiToolsConfigured,
|
|
282
415
|
steps,
|
|
283
416
|
};
|
|
284
417
|
if (format === 'json' || ci) {
|