guardrail-compliance 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/dist/audit/emitter.d.ts +97 -0
- package/dist/audit/emitter.d.ts.map +1 -0
- package/dist/audit/emitter.js +197 -0
- package/dist/audit/events.d.ts +304 -0
- package/dist/audit/events.d.ts.map +1 -0
- package/dist/audit/events.js +267 -0
- package/dist/audit/index.d.ts +11 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/index.js +51 -0
- package/dist/audit/storage.d.ts +93 -0
- package/dist/audit/storage.d.ts.map +1 -0
- package/dist/audit/storage.js +337 -0
- package/dist/automation/__tests__/compliance-scheduler.test.d.ts +2 -0
- package/dist/automation/__tests__/compliance-scheduler.test.d.ts.map +1 -0
- package/dist/automation/__tests__/compliance-scheduler.test.js +140 -0
- package/dist/automation/audit-logger.d.ts +129 -0
- package/dist/automation/audit-logger.d.ts.map +1 -0
- package/dist/automation/audit-logger.js +473 -0
- package/dist/automation/compliance-scheduler-fixed.d.ts +1 -0
- package/dist/automation/compliance-scheduler-fixed.d.ts.map +1 -0
- package/dist/automation/compliance-scheduler-fixed.js +1 -0
- package/dist/automation/compliance-scheduler.d.ts +83 -0
- package/dist/automation/compliance-scheduler.d.ts.map +1 -0
- package/dist/automation/compliance-scheduler.js +414 -0
- package/dist/automation/dashboard.d.ts +194 -0
- package/dist/automation/dashboard.d.ts.map +1 -0
- package/dist/automation/dashboard.js +768 -0
- package/dist/automation/email-service.d.ts +69 -0
- package/dist/automation/email-service.d.ts.map +1 -0
- package/dist/automation/email-service.js +218 -0
- package/dist/automation/evidence-collector.d.ts +140 -0
- package/dist/automation/evidence-collector.d.ts.map +1 -0
- package/dist/automation/evidence-collector.js +682 -0
- package/dist/automation/index.d.ts +8 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +24 -0
- package/dist/automation/pdf-exporter.d.ts +90 -0
- package/dist/automation/pdf-exporter.d.ts.map +1 -0
- package/dist/automation/pdf-exporter.js +381 -0
- package/dist/automation/reporting-engine.d.ts +116 -0
- package/dist/automation/reporting-engine.d.ts.map +1 -0
- package/dist/automation/reporting-engine.js +329 -0
- package/dist/container/index.d.ts +4 -0
- package/dist/container/index.d.ts.map +1 -0
- package/dist/container/index.js +19 -0
- package/dist/container/kubernetes.d.ts +94 -0
- package/dist/container/kubernetes.d.ts.map +1 -0
- package/dist/container/kubernetes.js +268 -0
- package/dist/container/rules.d.ts +27 -0
- package/dist/container/rules.d.ts.map +1 -0
- package/dist/container/rules.js +216 -0
- package/dist/container/scanner.d.ts +50 -0
- package/dist/container/scanner.d.ts.map +1 -0
- package/dist/container/scanner.js +143 -0
- package/dist/frameworks/engine.d.ts +108 -0
- package/dist/frameworks/engine.d.ts.map +1 -0
- package/dist/frameworks/engine.js +206 -0
- package/dist/frameworks/gdpr.d.ts +6 -0
- package/dist/frameworks/gdpr.d.ts.map +1 -0
- package/dist/frameworks/gdpr.js +198 -0
- package/dist/frameworks/hipaa.d.ts +6 -0
- package/dist/frameworks/hipaa.d.ts.map +1 -0
- package/dist/frameworks/hipaa.js +183 -0
- package/dist/frameworks/index.d.ts +8 -0
- package/dist/frameworks/index.d.ts.map +1 -0
- package/dist/frameworks/index.js +30 -0
- package/dist/frameworks/iso27001.d.ts +63 -0
- package/dist/frameworks/iso27001.d.ts.map +1 -0
- package/dist/frameworks/iso27001.js +331 -0
- package/dist/frameworks/nist.d.ts +62 -0
- package/dist/frameworks/nist.d.ts.map +1 -0
- package/dist/frameworks/nist.js +424 -0
- package/dist/frameworks/pci.d.ts +6 -0
- package/dist/frameworks/pci.d.ts.map +1 -0
- package/dist/frameworks/pci.js +201 -0
- package/dist/frameworks/soc2.d.ts +7 -0
- package/dist/frameworks/soc2.d.ts.map +1 -0
- package/dist/frameworks/soc2.js +248 -0
- package/dist/iac/drift-detector.d.ts +64 -0
- package/dist/iac/drift-detector.d.ts.map +1 -0
- package/dist/iac/drift-detector.js +134 -0
- package/dist/iac/index.d.ts +4 -0
- package/dist/iac/index.d.ts.map +1 -0
- package/dist/iac/index.js +19 -0
- package/dist/iac/rules.d.ts +17 -0
- package/dist/iac/rules.d.ts.map +1 -0
- package/dist/iac/rules.js +385 -0
- package/dist/iac/scanner.d.ts +104 -0
- package/dist/iac/scanner.d.ts.map +1 -0
- package/dist/iac/scanner.js +343 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/pii/data-flow.d.ts +58 -0
- package/dist/pii/data-flow.d.ts.map +1 -0
- package/dist/pii/data-flow.js +154 -0
- package/dist/pii/detector.d.ts +60 -0
- package/dist/pii/detector.d.ts.map +1 -0
- package/dist/pii/detector.js +267 -0
- package/dist/pii/index.d.ts +4 -0
- package/dist/pii/index.d.ts.map +1 -0
- package/dist/pii/index.js +19 -0
- package/dist/pii/patterns.d.ts +36 -0
- package/dist/pii/patterns.d.ts.map +1 -0
- package/dist/pii/patterns.js +108 -0
- package/dist/policy/index.d.ts +5 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +20 -0
- package/dist/policy/opa-engine.d.ts +121 -0
- package/dist/policy/opa-engine.d.ts.map +1 -0
- package/dist/policy/opa-engine.js +423 -0
- package/package.json +31 -0
- package/src/audit/emitter.ts +383 -0
- package/src/audit/events.ts +351 -0
- package/src/audit/index.ts +35 -0
- package/src/audit/storage.ts +394 -0
- package/src/automation/__tests__/compliance-scheduler.test.ts +183 -0
- package/src/automation/audit-logger.ts +629 -0
- package/src/automation/compliance-scheduler-fixed.ts +0 -0
- package/src/automation/compliance-scheduler.ts +516 -0
- package/src/automation/dashboard.ts +947 -0
- package/src/automation/email-service.ts +230 -0
- package/src/automation/evidence-collector.ts +866 -0
- package/src/automation/index.ts +8 -0
- package/src/automation/pdf-exporter.ts +434 -0
- package/src/automation/reporting-engine.ts +462 -0
- package/src/container/index.ts +3 -0
- package/src/container/kubernetes.ts +379 -0
- package/src/container/rules.ts +244 -0
- package/src/container/scanner.ts +202 -0
- package/src/frameworks/engine.ts +298 -0
- package/src/frameworks/gdpr.ts +204 -0
- package/src/frameworks/hipaa.ts +209 -0
- package/src/frameworks/index.ts +23 -0
- package/src/frameworks/iso27001.ts +398 -0
- package/src/frameworks/nist.ts +518 -0
- package/src/frameworks/pci.ts +226 -0
- package/src/frameworks/soc2.ts +281 -0
- package/src/iac/drift-detector.ts +197 -0
- package/src/iac/index.ts +3 -0
- package/src/iac/rules.ts +420 -0
- package/src/iac/scanner.ts +445 -0
- package/src/index.ts +17 -0
- package/src/pii/data-flow.ts +216 -0
- package/src/pii/detector.ts +327 -0
- package/src/pii/index.ts +3 -0
- package/src/pii/patterns.ts +128 -0
- package/src/policy/index.ts +5 -0
- package/src/policy/opa-engine.ts +504 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit Trail Event Schema
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive audit logging for Compliance+ tier.
|
|
5
|
+
* All events are hash-chained for tamper evidence.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { createHash } from 'crypto';
|
|
10
|
+
|
|
11
|
+
// Surface types - where the action originated
|
|
12
|
+
export type AuditSurface = 'cli' | 'vscode' | 'mcp' | 'web' | 'api' | 'ci';
|
|
13
|
+
|
|
14
|
+
// Action categories
|
|
15
|
+
export type AuditActionCategory =
|
|
16
|
+
| 'scan'
|
|
17
|
+
| 'ship'
|
|
18
|
+
| 'reality'
|
|
19
|
+
| 'autopilot'
|
|
20
|
+
| 'fix'
|
|
21
|
+
| 'gate'
|
|
22
|
+
| 'auth'
|
|
23
|
+
| 'config'
|
|
24
|
+
| 'export'
|
|
25
|
+
| 'ai'
|
|
26
|
+
| 'tool'
|
|
27
|
+
| 'system';
|
|
28
|
+
|
|
29
|
+
// Result types
|
|
30
|
+
export type AuditResult = 'success' | 'failure' | 'partial' | 'skipped' | 'error';
|
|
31
|
+
|
|
32
|
+
// Subscription tiers for audit access control
|
|
33
|
+
export type AuditTier = 'free' | 'starter' | 'pro' | 'compliance' | 'enterprise' | 'unlimited';
|
|
34
|
+
|
|
35
|
+
// Zod schemas for validation
|
|
36
|
+
export const AuditEventMetadataSchema = z.object({
|
|
37
|
+
// Command/action specific data
|
|
38
|
+
command: z.string().optional(),
|
|
39
|
+
args: z.array(z.string()).optional(),
|
|
40
|
+
flags: z.record(z.unknown()).optional(),
|
|
41
|
+
|
|
42
|
+
// Results
|
|
43
|
+
score: z.number().optional(),
|
|
44
|
+
grade: z.string().optional(),
|
|
45
|
+
issueCount: z.number().optional(),
|
|
46
|
+
fixCount: z.number().optional(),
|
|
47
|
+
|
|
48
|
+
// Context
|
|
49
|
+
projectPath: z.string().optional(),
|
|
50
|
+
gitBranch: z.string().optional(),
|
|
51
|
+
gitCommit: z.string().optional(),
|
|
52
|
+
|
|
53
|
+
// Performance
|
|
54
|
+
durationMs: z.number().optional(),
|
|
55
|
+
|
|
56
|
+
// Error info (if result is error)
|
|
57
|
+
errorCode: z.string().optional(),
|
|
58
|
+
errorMessage: z.string().optional(),
|
|
59
|
+
|
|
60
|
+
// Custom metadata
|
|
61
|
+
custom: z.record(z.unknown()).optional(),
|
|
62
|
+
}).passthrough();
|
|
63
|
+
|
|
64
|
+
export type AuditEventMetadata = z.infer<typeof AuditEventMetadataSchema>;
|
|
65
|
+
|
|
66
|
+
export const AuditEventSchema = z.object({
|
|
67
|
+
// Core identity
|
|
68
|
+
id: z.string().uuid(),
|
|
69
|
+
timestamp: z.string().datetime(),
|
|
70
|
+
|
|
71
|
+
// Actor information
|
|
72
|
+
actor: z.object({
|
|
73
|
+
id: z.string(),
|
|
74
|
+
type: z.enum(['user', 'system', 'ci', 'api']),
|
|
75
|
+
name: z.string().optional(),
|
|
76
|
+
email: z.string().email().optional(),
|
|
77
|
+
ip: z.string().optional(),
|
|
78
|
+
}),
|
|
79
|
+
|
|
80
|
+
// Event classification
|
|
81
|
+
surface: z.enum(['cli', 'vscode', 'mcp', 'web', 'api', 'ci']),
|
|
82
|
+
action: z.string(),
|
|
83
|
+
category: z.enum(['scan', 'ship', 'reality', 'autopilot', 'fix', 'gate', 'auth', 'config', 'export', 'ai', 'tool', 'system']),
|
|
84
|
+
|
|
85
|
+
// Target of the action
|
|
86
|
+
target: z.object({
|
|
87
|
+
type: z.string(),
|
|
88
|
+
id: z.string().optional(),
|
|
89
|
+
path: z.string().optional(),
|
|
90
|
+
name: z.string().optional(),
|
|
91
|
+
}),
|
|
92
|
+
|
|
93
|
+
// Access control
|
|
94
|
+
tier: z.enum(['free', 'starter', 'pro', 'compliance', 'enterprise', 'unlimited']),
|
|
95
|
+
|
|
96
|
+
// Outcome
|
|
97
|
+
result: z.enum(['success', 'failure', 'partial', 'skipped', 'error']),
|
|
98
|
+
|
|
99
|
+
// Additional context (tier-gated)
|
|
100
|
+
metadata: AuditEventMetadataSchema.optional(),
|
|
101
|
+
|
|
102
|
+
// Hash chain for tamper evidence
|
|
103
|
+
hash: z.string(),
|
|
104
|
+
prevHash: z.string(),
|
|
105
|
+
|
|
106
|
+
// Version for schema evolution
|
|
107
|
+
version: z.literal(1),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export type AuditEvent = z.infer<typeof AuditEventSchema>;
|
|
111
|
+
|
|
112
|
+
// Input type for creating events (before hash chain)
|
|
113
|
+
export interface AuditEventInput {
|
|
114
|
+
actor: AuditEvent['actor'];
|
|
115
|
+
surface: AuditSurface;
|
|
116
|
+
action: string;
|
|
117
|
+
category: AuditActionCategory;
|
|
118
|
+
target: AuditEvent['target'];
|
|
119
|
+
tier: AuditTier;
|
|
120
|
+
result: AuditResult;
|
|
121
|
+
metadata?: AuditEventMetadata;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Redaction patterns for sensitive data
|
|
125
|
+
const REDACTION_PATTERNS = [
|
|
126
|
+
// API keys
|
|
127
|
+
/(?:api[_-]?key|apikey|token|secret|password|pwd|auth)[=:]\s*['"]?([a-zA-Z0-9_\-]{16,})['"]?/gi,
|
|
128
|
+
// JWT tokens
|
|
129
|
+
/eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/g,
|
|
130
|
+
// AWS keys
|
|
131
|
+
/(?:AKIA|ABIA|ACCA|ASIA)[A-Z0-9]{16}/g,
|
|
132
|
+
// Generic secrets
|
|
133
|
+
/(?:sk_live_|sk_test_|pk_live_|pk_test_)[a-zA-Z0-9]+/g,
|
|
134
|
+
// Email addresses (partial redaction)
|
|
135
|
+
/([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g,
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Redact sensitive information from a string
|
|
140
|
+
*/
|
|
141
|
+
export function redactSensitive(input: string): string {
|
|
142
|
+
let result = input;
|
|
143
|
+
|
|
144
|
+
for (const pattern of REDACTION_PATTERNS) {
|
|
145
|
+
result = result.replace(pattern, (match, ...groups) => {
|
|
146
|
+
// For email, keep domain
|
|
147
|
+
if (match.includes('@')) {
|
|
148
|
+
return `[REDACTED]@${groups[1]}`;
|
|
149
|
+
}
|
|
150
|
+
// For other patterns, show type hint
|
|
151
|
+
const typeHint = match.slice(0, 4).toLowerCase();
|
|
152
|
+
return `[REDACTED:${typeHint}...]`;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Redact metadata based on tier
|
|
161
|
+
* - Compliance+: Full metadata
|
|
162
|
+
* - Pro: Limited metadata (no prompt bodies)
|
|
163
|
+
* - Free/Starter: Minimal (action + result only)
|
|
164
|
+
*/
|
|
165
|
+
export function redactMetadataForTier(
|
|
166
|
+
metadata: AuditEventMetadata | undefined,
|
|
167
|
+
tier: AuditTier
|
|
168
|
+
): AuditEventMetadata | undefined {
|
|
169
|
+
if (!metadata) return undefined;
|
|
170
|
+
|
|
171
|
+
// Compliance+ and Enterprise get full metadata (still redact secrets)
|
|
172
|
+
if (tier === 'compliance' || tier === 'enterprise' || tier === 'unlimited') {
|
|
173
|
+
return redactMetadataSecrets(metadata);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Pro gets limited metadata
|
|
177
|
+
if (tier === 'pro') {
|
|
178
|
+
const limited: AuditEventMetadata = {
|
|
179
|
+
command: metadata.command,
|
|
180
|
+
score: metadata.score,
|
|
181
|
+
grade: metadata.grade,
|
|
182
|
+
issueCount: metadata.issueCount,
|
|
183
|
+
fixCount: metadata.fixCount,
|
|
184
|
+
durationMs: metadata.durationMs,
|
|
185
|
+
errorCode: metadata.errorCode,
|
|
186
|
+
};
|
|
187
|
+
return redactMetadataSecrets(limited);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Free/Starter get minimal
|
|
191
|
+
return {
|
|
192
|
+
score: metadata.score,
|
|
193
|
+
grade: metadata.grade,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Recursively redact secrets from metadata
|
|
199
|
+
*/
|
|
200
|
+
function redactMetadataSecrets(metadata: AuditEventMetadata): AuditEventMetadata {
|
|
201
|
+
const result: AuditEventMetadata = {};
|
|
202
|
+
|
|
203
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
204
|
+
if (value === undefined) continue;
|
|
205
|
+
|
|
206
|
+
if (typeof value === 'string') {
|
|
207
|
+
result[key] = redactSensitive(value);
|
|
208
|
+
} else if (Array.isArray(value)) {
|
|
209
|
+
result[key] = value.map(v =>
|
|
210
|
+
typeof v === 'string' ? redactSensitive(v) : v
|
|
211
|
+
);
|
|
212
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
213
|
+
result[key] = redactMetadataSecrets(value as AuditEventMetadata);
|
|
214
|
+
} else {
|
|
215
|
+
result[key] = value;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Compute SHA-256 hash of event for chain integrity
|
|
224
|
+
*/
|
|
225
|
+
export function computeEventHash(event: Omit<AuditEvent, 'hash'>): string {
|
|
226
|
+
const payload = JSON.stringify({
|
|
227
|
+
id: event.id,
|
|
228
|
+
timestamp: event.timestamp,
|
|
229
|
+
actor: event.actor,
|
|
230
|
+
surface: event.surface,
|
|
231
|
+
action: event.action,
|
|
232
|
+
category: event.category,
|
|
233
|
+
target: event.target,
|
|
234
|
+
tier: event.tier,
|
|
235
|
+
result: event.result,
|
|
236
|
+
metadata: event.metadata,
|
|
237
|
+
prevHash: event.prevHash,
|
|
238
|
+
version: event.version,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
return createHash('sha256').update(payload).digest('hex');
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Verify hash chain integrity
|
|
246
|
+
*/
|
|
247
|
+
export function verifyEventHash(event: AuditEvent): boolean {
|
|
248
|
+
const { hash, ...eventWithoutHash } = event;
|
|
249
|
+
const computedHash = computeEventHash(eventWithoutHash);
|
|
250
|
+
return computedHash === hash;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Create a new audit event with proper hash chaining
|
|
255
|
+
*/
|
|
256
|
+
export function createAuditEvent(
|
|
257
|
+
input: AuditEventInput,
|
|
258
|
+
prevHash: string = '0'.repeat(64) // Genesis hash
|
|
259
|
+
): AuditEvent {
|
|
260
|
+
const id = crypto.randomUUID();
|
|
261
|
+
const timestamp = new Date().toISOString();
|
|
262
|
+
|
|
263
|
+
// Redact metadata based on tier
|
|
264
|
+
const redactedMetadata = redactMetadataForTier(input.metadata, input.tier);
|
|
265
|
+
|
|
266
|
+
const eventWithoutHash: Omit<AuditEvent, 'hash'> = {
|
|
267
|
+
id,
|
|
268
|
+
timestamp,
|
|
269
|
+
actor: input.actor,
|
|
270
|
+
surface: input.surface,
|
|
271
|
+
action: input.action,
|
|
272
|
+
category: input.category,
|
|
273
|
+
target: input.target,
|
|
274
|
+
tier: input.tier,
|
|
275
|
+
result: input.result,
|
|
276
|
+
metadata: redactedMetadata,
|
|
277
|
+
prevHash,
|
|
278
|
+
version: 1,
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const hash = computeEventHash(eventWithoutHash);
|
|
282
|
+
|
|
283
|
+
return {
|
|
284
|
+
...eventWithoutHash,
|
|
285
|
+
hash,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Pre-defined action types for consistency
|
|
290
|
+
export const AuditActions = {
|
|
291
|
+
// Scan actions
|
|
292
|
+
SCAN_START: 'scan.start',
|
|
293
|
+
SCAN_COMPLETE: 'scan.complete',
|
|
294
|
+
SCAN_ERROR: 'scan.error',
|
|
295
|
+
|
|
296
|
+
// Ship actions
|
|
297
|
+
SHIP_CHECK: 'ship.check',
|
|
298
|
+
SHIP_APPROVE: 'ship.approve',
|
|
299
|
+
SHIP_REJECT: 'ship.reject',
|
|
300
|
+
|
|
301
|
+
// Reality actions
|
|
302
|
+
REALITY_START: 'reality.start',
|
|
303
|
+
REALITY_COMPLETE: 'reality.complete',
|
|
304
|
+
REALITY_ERROR: 'reality.error',
|
|
305
|
+
|
|
306
|
+
// Autopilot actions
|
|
307
|
+
AUTOPILOT_ENABLE: 'autopilot.enable',
|
|
308
|
+
AUTOPILOT_DISABLE: 'autopilot.disable',
|
|
309
|
+
AUTOPILOT_RUN: 'autopilot.run',
|
|
310
|
+
AUTOPILOT_REPORT: 'autopilot.report',
|
|
311
|
+
|
|
312
|
+
// Fix actions
|
|
313
|
+
FIX_PLAN: 'fix.plan',
|
|
314
|
+
FIX_APPLY: 'fix.apply',
|
|
315
|
+
FIX_REVERT: 'fix.revert',
|
|
316
|
+
|
|
317
|
+
// Gate actions
|
|
318
|
+
GATE_CHECK: 'gate.check',
|
|
319
|
+
GATE_PASS: 'gate.pass',
|
|
320
|
+
GATE_FAIL: 'gate.fail',
|
|
321
|
+
|
|
322
|
+
// Auth actions
|
|
323
|
+
AUTH_LOGIN: 'auth.login',
|
|
324
|
+
AUTH_LOGOUT: 'auth.logout',
|
|
325
|
+
AUTH_TOKEN_REFRESH: 'auth.token_refresh',
|
|
326
|
+
|
|
327
|
+
// Config actions
|
|
328
|
+
CONFIG_UPDATE: 'config.update',
|
|
329
|
+
CONFIG_RESET: 'config.reset',
|
|
330
|
+
|
|
331
|
+
// Export actions
|
|
332
|
+
EXPORT_REPORT: 'export.report',
|
|
333
|
+
EXPORT_AUDIT: 'export.audit',
|
|
334
|
+
|
|
335
|
+
// AI actions
|
|
336
|
+
AI_VALIDATE: 'ai.validate',
|
|
337
|
+
AI_SUGGEST: 'ai.suggest',
|
|
338
|
+
AI_CHECKPOINT: 'ai.checkpoint',
|
|
339
|
+
|
|
340
|
+
// MCP Tool actions
|
|
341
|
+
TOOL_INVOKE: 'tool.invoke',
|
|
342
|
+
TOOL_COMPLETE: 'tool.complete',
|
|
343
|
+
TOOL_ERROR: 'tool.error',
|
|
344
|
+
|
|
345
|
+
// System actions
|
|
346
|
+
SYSTEM_INIT: 'system.init',
|
|
347
|
+
SYSTEM_UPGRADE: 'system.upgrade',
|
|
348
|
+
SYSTEM_ERROR: 'system.error',
|
|
349
|
+
} as const;
|
|
350
|
+
|
|
351
|
+
export type AuditActionType = typeof AuditActions[keyof typeof AuditActions];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit Trail Module
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive audit logging for Compliance+ tier.
|
|
5
|
+
* Exports all audit functionality.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Event types and schemas
|
|
9
|
+
export * from './events';
|
|
10
|
+
|
|
11
|
+
// Storage adapters
|
|
12
|
+
export * from './storage';
|
|
13
|
+
|
|
14
|
+
// Emitter (main API)
|
|
15
|
+
export {
|
|
16
|
+
audit,
|
|
17
|
+
configureAudit,
|
|
18
|
+
emit,
|
|
19
|
+
emitAction,
|
|
20
|
+
emitScanStart,
|
|
21
|
+
emitScanComplete,
|
|
22
|
+
emitShipCheck,
|
|
23
|
+
emitRealityStart,
|
|
24
|
+
emitRealityComplete,
|
|
25
|
+
emitAutopilotAction,
|
|
26
|
+
emitFixPlan,
|
|
27
|
+
emitFixApply,
|
|
28
|
+
emitGateCheck,
|
|
29
|
+
emitToolInvoke,
|
|
30
|
+
emitAuth,
|
|
31
|
+
hasFullAuditAccess,
|
|
32
|
+
} from './emitter';
|
|
33
|
+
|
|
34
|
+
// Default export
|
|
35
|
+
export { default } from './emitter';
|