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,69 @@
|
|
|
1
|
+
export interface EmailConfig {
|
|
2
|
+
host: string;
|
|
3
|
+
port: number;
|
|
4
|
+
secure?: boolean;
|
|
5
|
+
auth: {
|
|
6
|
+
user: string;
|
|
7
|
+
pass: string;
|
|
8
|
+
};
|
|
9
|
+
from: string;
|
|
10
|
+
}
|
|
11
|
+
export interface EmailMessage {
|
|
12
|
+
to: string | string[];
|
|
13
|
+
subject: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
html?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface EmailResult {
|
|
18
|
+
success: boolean;
|
|
19
|
+
messageId?: string;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Email Service for Guardrail notifications
|
|
24
|
+
*
|
|
25
|
+
* Supports SMTP-based email delivery via nodemailer.
|
|
26
|
+
* Configure via environment variables:
|
|
27
|
+
* - EMAIL_FROM: sender email address
|
|
28
|
+
* - SMTP_HOST: SMTP server hostname
|
|
29
|
+
* - SMTP_PORT: SMTP server port (default: 587)
|
|
30
|
+
* - SMTP_USER: SMTP authentication username
|
|
31
|
+
* - SMTP_PASS: SMTP authentication password
|
|
32
|
+
* - SMTP_SECURE: Use TLS (default: false for port 587, true for port 465)
|
|
33
|
+
*/
|
|
34
|
+
export declare class EmailService {
|
|
35
|
+
private transporter;
|
|
36
|
+
private config;
|
|
37
|
+
constructor();
|
|
38
|
+
/**
|
|
39
|
+
* Initialize email configuration from environment variables
|
|
40
|
+
*/
|
|
41
|
+
private initializeFromEnv;
|
|
42
|
+
/**
|
|
43
|
+
* Create nodemailer transporter with current config
|
|
44
|
+
*/
|
|
45
|
+
private createTransporter;
|
|
46
|
+
/**
|
|
47
|
+
* Check if email service is configured and available
|
|
48
|
+
*/
|
|
49
|
+
isConfigured(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Verify SMTP connection
|
|
52
|
+
*/
|
|
53
|
+
verifyConnection(): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Send an email
|
|
56
|
+
*/
|
|
57
|
+
send(message: EmailMessage): Promise<EmailResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Send compliance check notification email
|
|
60
|
+
*/
|
|
61
|
+
sendComplianceNotification(recipients: string[], projectId: string, frameworkId: string, result: {
|
|
62
|
+
status: "completed" | "failed";
|
|
63
|
+
score?: number;
|
|
64
|
+
summary?: string;
|
|
65
|
+
reportUrl?: string;
|
|
66
|
+
}): Promise<EmailResult>;
|
|
67
|
+
}
|
|
68
|
+
export declare const emailService: EmailService;
|
|
69
|
+
//# sourceMappingURL=email-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-service.d.ts","sourceRoot":"","sources":["../../src/automation/email-service.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,MAAM,CAA4B;;IAM1C;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAmBzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAY1C;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAmCvD;;OAEG;IACG,0BAA0B,CAC9B,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE;QACN,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,WAAW,CAAC;CAuExB;AAGD,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.emailService = exports.EmailService = void 0;
|
|
37
|
+
const nodemailer = __importStar(require("nodemailer"));
|
|
38
|
+
/**
|
|
39
|
+
* Email Service for Guardrail notifications
|
|
40
|
+
*
|
|
41
|
+
* Supports SMTP-based email delivery via nodemailer.
|
|
42
|
+
* Configure via environment variables:
|
|
43
|
+
* - EMAIL_FROM: sender email address
|
|
44
|
+
* - SMTP_HOST: SMTP server hostname
|
|
45
|
+
* - SMTP_PORT: SMTP server port (default: 587)
|
|
46
|
+
* - SMTP_USER: SMTP authentication username
|
|
47
|
+
* - SMTP_PASS: SMTP authentication password
|
|
48
|
+
* - SMTP_SECURE: Use TLS (default: false for port 587, true for port 465)
|
|
49
|
+
*/
|
|
50
|
+
class EmailService {
|
|
51
|
+
transporter = null;
|
|
52
|
+
config = null;
|
|
53
|
+
constructor() {
|
|
54
|
+
this.initializeFromEnv();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Initialize email configuration from environment variables
|
|
58
|
+
*/
|
|
59
|
+
initializeFromEnv() {
|
|
60
|
+
const host = process.env["SMTP_HOST"];
|
|
61
|
+
const port = parseInt(process.env["SMTP_PORT"] || "587", 10);
|
|
62
|
+
const user = process.env["SMTP_USER"];
|
|
63
|
+
const pass = process.env["SMTP_PASS"];
|
|
64
|
+
const from = process.env["EMAIL_FROM"];
|
|
65
|
+
if (host && user && pass && from) {
|
|
66
|
+
this.config = {
|
|
67
|
+
host,
|
|
68
|
+
port,
|
|
69
|
+
secure: process.env["SMTP_SECURE"] === "true" || port === 465,
|
|
70
|
+
auth: { user, pass },
|
|
71
|
+
from,
|
|
72
|
+
};
|
|
73
|
+
this.createTransporter();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Create nodemailer transporter with current config
|
|
78
|
+
*/
|
|
79
|
+
createTransporter() {
|
|
80
|
+
if (!this.config)
|
|
81
|
+
return;
|
|
82
|
+
this.transporter = nodemailer.createTransport({
|
|
83
|
+
host: this.config.host,
|
|
84
|
+
port: this.config.port,
|
|
85
|
+
secure: this.config.secure,
|
|
86
|
+
auth: this.config.auth,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Check if email service is configured and available
|
|
91
|
+
*/
|
|
92
|
+
isConfigured() {
|
|
93
|
+
return this.transporter !== null && this.config !== null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Verify SMTP connection
|
|
97
|
+
*/
|
|
98
|
+
async verifyConnection() {
|
|
99
|
+
if (!this.transporter)
|
|
100
|
+
return false;
|
|
101
|
+
try {
|
|
102
|
+
await this.transporter.verify();
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.error("Email service verification failed:", error);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Send an email
|
|
112
|
+
*/
|
|
113
|
+
async send(message) {
|
|
114
|
+
if (!this.transporter || !this.config) {
|
|
115
|
+
return {
|
|
116
|
+
success: false,
|
|
117
|
+
error: "Email service not configured. Set SMTP_HOST, SMTP_USER, SMTP_PASS, and EMAIL_FROM environment variables.",
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const recipients = Array.isArray(message.to)
|
|
122
|
+
? message.to.join(", ")
|
|
123
|
+
: message.to;
|
|
124
|
+
const result = await this.transporter.sendMail({
|
|
125
|
+
from: this.config.from,
|
|
126
|
+
to: recipients,
|
|
127
|
+
subject: message.subject,
|
|
128
|
+
text: message.text,
|
|
129
|
+
html: message.html,
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
success: true,
|
|
133
|
+
messageId: result.messageId,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
138
|
+
console.error("Failed to send email:", errorMessage);
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
error: errorMessage,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Send compliance check notification email
|
|
147
|
+
*/
|
|
148
|
+
async sendComplianceNotification(recipients, projectId, frameworkId, result) {
|
|
149
|
+
const statusEmoji = result.status === "completed" ? "✅" : "❌";
|
|
150
|
+
const statusText = result.status === "completed" ? "Completed" : "Failed";
|
|
151
|
+
const scoreText = result.score !== undefined ? `${result.score}%` : "N/A";
|
|
152
|
+
const subject = `[Guardrail] Compliance Check ${statusText}: ${frameworkId}`;
|
|
153
|
+
const html = `
|
|
154
|
+
<!DOCTYPE html>
|
|
155
|
+
<html>
|
|
156
|
+
<head>
|
|
157
|
+
<style>
|
|
158
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: #333; }
|
|
159
|
+
.container { max-width: 600px; margin: 0 auto; padding: 20px; }
|
|
160
|
+
.header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 20px; border-radius: 8px 8px 0 0; }
|
|
161
|
+
.content { background: #f9fafb; padding: 20px; border: 1px solid #e5e7eb; border-top: none; border-radius: 0 0 8px 8px; }
|
|
162
|
+
.status { font-size: 24px; margin-bottom: 10px; }
|
|
163
|
+
.metric { background: white; padding: 15px; border-radius: 8px; margin: 10px 0; border: 1px solid #e5e7eb; }
|
|
164
|
+
.metric-label { color: #6b7280; font-size: 12px; text-transform: uppercase; }
|
|
165
|
+
.metric-value { font-size: 20px; font-weight: 600; color: #111827; }
|
|
166
|
+
.button { display: inline-block; background: #667eea; color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; margin-top: 15px; }
|
|
167
|
+
.footer { text-align: center; color: #6b7280; font-size: 12px; margin-top: 20px; }
|
|
168
|
+
</style>
|
|
169
|
+
</head>
|
|
170
|
+
<body>
|
|
171
|
+
<div class="container">
|
|
172
|
+
<div class="header">
|
|
173
|
+
<div class="status">${statusEmoji} Compliance Check ${statusText}</div>
|
|
174
|
+
<div>Project: ${projectId}</div>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="content">
|
|
177
|
+
<div class="metric">
|
|
178
|
+
<div class="metric-label">Framework</div>
|
|
179
|
+
<div class="metric-value">${frameworkId}</div>
|
|
180
|
+
</div>
|
|
181
|
+
<div class="metric">
|
|
182
|
+
<div class="metric-label">Compliance Score</div>
|
|
183
|
+
<div class="metric-value">${scoreText}</div>
|
|
184
|
+
</div>
|
|
185
|
+
${result.summary ? `<p>${result.summary}</p>` : ""}
|
|
186
|
+
${result.reportUrl ? `<a href="${result.reportUrl}" class="button">View Full Report</a>` : ""}
|
|
187
|
+
</div>
|
|
188
|
+
<div class="footer">
|
|
189
|
+
<p>Sent by Guardrail Compliance Automation</p>
|
|
190
|
+
<p>Context Enhanced by Guardrail AI</p>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</body>
|
|
194
|
+
</html>
|
|
195
|
+
`.trim();
|
|
196
|
+
const text = `
|
|
197
|
+
Compliance Check ${statusText}
|
|
198
|
+
|
|
199
|
+
Project: ${projectId}
|
|
200
|
+
Framework: ${frameworkId}
|
|
201
|
+
Score: ${scoreText}
|
|
202
|
+
${result.summary ? `\nSummary: ${result.summary}` : ""}
|
|
203
|
+
${result.reportUrl ? `\nView Report: ${result.reportUrl}` : ""}
|
|
204
|
+
|
|
205
|
+
--
|
|
206
|
+
Sent by Guardrail Compliance Automation
|
|
207
|
+
`.trim();
|
|
208
|
+
return this.send({
|
|
209
|
+
to: recipients,
|
|
210
|
+
subject,
|
|
211
|
+
text,
|
|
212
|
+
html,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
exports.EmailService = EmailService;
|
|
217
|
+
// Singleton instance
|
|
218
|
+
exports.emailService = new EmailService();
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { ComplianceAssessmentResult } from '../frameworks/engine';
|
|
2
|
+
export interface EvidenceArtifact {
|
|
3
|
+
id: string;
|
|
4
|
+
controlId: string;
|
|
5
|
+
type: 'document' | 'configuration' | 'screenshot' | 'log' | 'code' | 'test' | 'metadata';
|
|
6
|
+
name: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
content?: string;
|
|
9
|
+
hash: string;
|
|
10
|
+
size: number;
|
|
11
|
+
timestamp: Date;
|
|
12
|
+
metadata: any;
|
|
13
|
+
}
|
|
14
|
+
interface EvidenceCollection {
|
|
15
|
+
id: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
frameworkId?: string;
|
|
20
|
+
assessmentId?: string;
|
|
21
|
+
artifacts: EvidenceArtifact[];
|
|
22
|
+
summary: {
|
|
23
|
+
totalArtifacts: number;
|
|
24
|
+
byType: Record<string, number>;
|
|
25
|
+
size: number;
|
|
26
|
+
hash: string;
|
|
27
|
+
};
|
|
28
|
+
timestamp: Date;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Evidence Collection Engine
|
|
32
|
+
*
|
|
33
|
+
* Automatically collects, preserves, and manages evidence
|
|
34
|
+
* for compliance assessments and audits
|
|
35
|
+
*/
|
|
36
|
+
export declare class EvidenceCollector {
|
|
37
|
+
/**
|
|
38
|
+
* Collect evidence for a compliance assessment
|
|
39
|
+
*/
|
|
40
|
+
collectForAssessment(projectId: string, frameworkId: string, assessment: ComplianceAssessmentResult): Promise<EvidenceArtifact[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Collect evidence for a specific control
|
|
43
|
+
*/
|
|
44
|
+
private collectControlEvidence;
|
|
45
|
+
/**
|
|
46
|
+
* Collect data protection evidence
|
|
47
|
+
*/
|
|
48
|
+
private collectDataProtectionEvidence;
|
|
49
|
+
/**
|
|
50
|
+
* Collect security evidence
|
|
51
|
+
*/
|
|
52
|
+
private collectSecurityEvidence;
|
|
53
|
+
/**
|
|
54
|
+
* Collect access control evidence
|
|
55
|
+
*/
|
|
56
|
+
private collectAccessControlEvidence;
|
|
57
|
+
/**
|
|
58
|
+
* Collect incident response evidence
|
|
59
|
+
*/
|
|
60
|
+
private collectIncidentResponseEvidence;
|
|
61
|
+
/**
|
|
62
|
+
* Collect logging evidence
|
|
63
|
+
*/
|
|
64
|
+
private collectLoggingEvidence;
|
|
65
|
+
/**
|
|
66
|
+
* Collect general evidence
|
|
67
|
+
*/
|
|
68
|
+
private collectGeneralEvidence;
|
|
69
|
+
/**
|
|
70
|
+
* Collect a document artifact
|
|
71
|
+
*/
|
|
72
|
+
private collectDocument;
|
|
73
|
+
/**
|
|
74
|
+
* Collect a configuration artifact
|
|
75
|
+
*/
|
|
76
|
+
private collectConfiguration;
|
|
77
|
+
/**
|
|
78
|
+
* Collect a code artifact
|
|
79
|
+
*/
|
|
80
|
+
private collectCodeArtifact;
|
|
81
|
+
/**
|
|
82
|
+
* Collect metadata file
|
|
83
|
+
*/
|
|
84
|
+
private collectMetadataFile;
|
|
85
|
+
/**
|
|
86
|
+
* Find files by pattern
|
|
87
|
+
*/
|
|
88
|
+
private findFilesByPattern;
|
|
89
|
+
/**
|
|
90
|
+
* Simple glob implementation
|
|
91
|
+
*/
|
|
92
|
+
private globFiles;
|
|
93
|
+
/**
|
|
94
|
+
* Check if filename matches pattern
|
|
95
|
+
*/
|
|
96
|
+
private matchesPattern;
|
|
97
|
+
/**
|
|
98
|
+
* Create metadata artifact
|
|
99
|
+
*/
|
|
100
|
+
private createMetadataArtifact;
|
|
101
|
+
/**
|
|
102
|
+
* Redact sensitive data from content
|
|
103
|
+
*/
|
|
104
|
+
private redactSensitiveData;
|
|
105
|
+
/**
|
|
106
|
+
* Redact sensitive configuration values
|
|
107
|
+
*/
|
|
108
|
+
private redactConfiguration;
|
|
109
|
+
/**
|
|
110
|
+
* Detect programming language from file extension
|
|
111
|
+
*/
|
|
112
|
+
private detectLanguage;
|
|
113
|
+
/**
|
|
114
|
+
* Group artifacts by type
|
|
115
|
+
*/
|
|
116
|
+
private groupArtifactsByType;
|
|
117
|
+
/**
|
|
118
|
+
* Calculate total size of artifacts
|
|
119
|
+
*/
|
|
120
|
+
private calculateTotalSize;
|
|
121
|
+
/**
|
|
122
|
+
* Calculate hash of artifacts
|
|
123
|
+
*/
|
|
124
|
+
private calculateHash;
|
|
125
|
+
/**
|
|
126
|
+
* Store evidence collection in database
|
|
127
|
+
*/
|
|
128
|
+
private storeEvidenceCollection;
|
|
129
|
+
/**
|
|
130
|
+
* Retrieve evidence collection
|
|
131
|
+
*/
|
|
132
|
+
getEvidenceCollection(collectionId: string): Promise<EvidenceCollection | null>;
|
|
133
|
+
/**
|
|
134
|
+
* List evidence collections for a project
|
|
135
|
+
*/
|
|
136
|
+
listEvidenceCollections(projectId: string): Promise<EvidenceCollection[]>;
|
|
137
|
+
}
|
|
138
|
+
export declare const evidenceCollector: EvidenceCollector;
|
|
139
|
+
export {};
|
|
140
|
+
//# sourceMappingURL=evidence-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence-collector.d.ts","sourceRoot":"","sources":["../../src/automation/evidence-collector.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,UAAU,GAAG,eAAe,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,iBAAiB;IAG5B;;OAEG;IACG,oBAAoB,CACxB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,0BAA0B,GACrC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAgD9B;;OAEG;YACW,sBAAsB;IAkCpC;;OAEG;YACW,6BAA6B;IAmD3C;;OAEG;YACW,uBAAuB;IA6DrC;;OAEG;YACW,4BAA4B;IAyC1C;;OAEG;YACW,+BAA+B;IAmC7C;;OAEG;YACW,sBAAsB;IA+BpC;;OAEG;YACW,sBAAsB;IAsBpC;;OAEG;YACW,eAAe;IAyC7B;;OAEG;YACW,oBAAoB;IAwClC;;OAEG;YACW,mBAAmB;IAsCjC;;OAEG;YACW,mBAAmB;IAqCjC;;OAEG;YACW,kBAAkB;IA0BhC;;OAEG;IACH,OAAO,CAAC,SAAS;IAgCjB;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;YACW,sBAAsB;IAgCpC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAmCtB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;YACW,aAAa;IAU3B;;OAEG;YACW,uBAAuB;IAsBrC;;OAEG;IACG,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IA8BrF;;OAEG;IACG,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;CA4BhF;AAGD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|