@panguard-ai/panguard-report 0.1.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/assessors/index.d.ts +26 -0
- package/dist/assessors/index.d.ts.map +1 -0
- package/dist/assessors/index.js +408 -0
- package/dist/assessors/index.js.map +1 -0
- package/dist/cli/index.d.ts +54 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +299 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/frameworks/index.d.ts +26 -0
- package/dist/frameworks/index.d.ts.map +1 -0
- package/dist/frameworks/index.js +57 -0
- package/dist/frameworks/index.js.map +1 -0
- package/dist/frameworks/iso27001.d.ts +16 -0
- package/dist/frameworks/iso27001.d.ts.map +1 -0
- package/dist/frameworks/iso27001.js +290 -0
- package/dist/frameworks/iso27001.js.map +1 -0
- package/dist/frameworks/soc2.d.ts +16 -0
- package/dist/frameworks/soc2.d.ts.map +1 -0
- package/dist/frameworks/soc2.js +106 -0
- package/dist/frameworks/soc2.js.map +1 -0
- package/dist/frameworks/tw-cyber-security.d.ts +17 -0
- package/dist/frameworks/tw-cyber-security.d.ts.map +1 -0
- package/dist/frameworks/tw-cyber-security.js +107 -0
- package/dist/frameworks/tw-cyber-security.js.map +1 -0
- package/dist/generator/index.d.ts +8 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +8 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/report-generator.d.ts +48 -0
- package/dist/generator/report-generator.d.ts.map +1 -0
- package/dist/generator/report-generator.js +160 -0
- package/dist/generator/report-generator.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/mapper/compliance-mapper.d.ts +31 -0
- package/dist/mapper/compliance-mapper.d.ts.map +1 -0
- package/dist/mapper/compliance-mapper.js +265 -0
- package/dist/mapper/compliance-mapper.js.map +1 -0
- package/dist/mapper/index.d.ts +8 -0
- package/dist/mapper/index.d.ts.map +1 -0
- package/dist/mapper/index.js +8 -0
- package/dist/mapper/index.js.map +1 -0
- package/dist/templates/index.d.ts +69 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +188 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/types.d.ts +176 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/dist/types.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compliance Assessors - Active system assessment for compliance controls
|
|
3
|
+
* 合規評估器 - 主動評估系統狀態以判定合規控制項
|
|
4
|
+
*
|
|
5
|
+
* Each assessor checks real system state and generates ComplianceFinding objects.
|
|
6
|
+
* The assessors run actual system commands (same approach as panguard-scan).
|
|
7
|
+
*
|
|
8
|
+
* @module @panguard-ai/panguard-report/assessors
|
|
9
|
+
*/
|
|
10
|
+
import type { ComplianceFinding } from '../types.js';
|
|
11
|
+
export declare function assessAccessControl(): Promise<ComplianceFinding[]>;
|
|
12
|
+
export declare function assessFirewallAndNetwork(): Promise<ComplianceFinding[]>;
|
|
13
|
+
export declare function assessEncryption(): Promise<ComplianceFinding[]>;
|
|
14
|
+
export declare function assessMonitoring(): Promise<ComplianceFinding[]>;
|
|
15
|
+
export declare function assessPatching(): Promise<ComplianceFinding[]>;
|
|
16
|
+
export declare function assessIncidentResponse(): Promise<ComplianceFinding[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Run all assessments for a given framework's control categories.
|
|
19
|
+
* Returns deduplicated findings.
|
|
20
|
+
*/
|
|
21
|
+
export declare function runAssessment(controlCategories: string[]): Promise<ComplianceFinding[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Run full system assessment (all assessors).
|
|
24
|
+
*/
|
|
25
|
+
export declare function runFullAssessment(): Promise<ComplianceFinding[]>;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assessors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAwCrD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA0GxE;AAMD,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAiG7E;AAMD,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAsErE;AAMD,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA+ErE;AAMD,wBAAsB,cAAc,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA8CnE;AAMD,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAmC3E;AAwCD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA8B7F;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAGtE"}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compliance Assessors - Active system assessment for compliance controls
|
|
3
|
+
* 合規評估器 - 主動評估系統狀態以判定合規控制項
|
|
4
|
+
*
|
|
5
|
+
* Each assessor checks real system state and generates ComplianceFinding objects.
|
|
6
|
+
* The assessors run actual system commands (same approach as panguard-scan).
|
|
7
|
+
*
|
|
8
|
+
* @module @panguard-ai/panguard-report/assessors
|
|
9
|
+
*/
|
|
10
|
+
import { execFile } from 'node:child_process';
|
|
11
|
+
import { platform } from 'node:os';
|
|
12
|
+
import { readFileSync, existsSync, readdirSync } from 'node:fs';
|
|
13
|
+
import { createLogger } from '@panguard-ai/core';
|
|
14
|
+
const logger = createLogger('panguard-report:assessors');
|
|
15
|
+
const os = platform();
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Utility
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
function execPromise(cmd, args, timeout = 10000) {
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
execFile(cmd, args, { timeout }, (error, stdout) => {
|
|
22
|
+
resolve(error ? '' : stdout.trim());
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function makeFinding(id, severity, title, description, category) {
|
|
27
|
+
return {
|
|
28
|
+
findingId: id,
|
|
29
|
+
severity,
|
|
30
|
+
title,
|
|
31
|
+
description,
|
|
32
|
+
category,
|
|
33
|
+
timestamp: new Date(),
|
|
34
|
+
source: 'panguard-scan',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Access Control Assessor
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
export async function assessAccessControl() {
|
|
41
|
+
const findings = [];
|
|
42
|
+
// Check password policy
|
|
43
|
+
try {
|
|
44
|
+
if (os === 'linux') {
|
|
45
|
+
const pwquality = existsSync('/etc/security/pwquality.conf')
|
|
46
|
+
? readFileSync('/etc/security/pwquality.conf', 'utf-8')
|
|
47
|
+
: '';
|
|
48
|
+
const pamPassword = existsSync('/etc/pam.d/common-password')
|
|
49
|
+
? readFileSync('/etc/pam.d/common-password', 'utf-8')
|
|
50
|
+
: '';
|
|
51
|
+
const minLen = pwquality.match(/minlen\s*=\s*(\d+)/);
|
|
52
|
+
const length = minLen ? parseInt(minLen[1], 10) : 0;
|
|
53
|
+
if (length < 8) {
|
|
54
|
+
findings.push(makeFinding('AC-PWD-001', 'high', 'Weak password policy', `Minimum password length is ${length || 'not set'} (should be >= 12). /etc/security/pwquality.conf minlen is inadequate.`, 'password'));
|
|
55
|
+
}
|
|
56
|
+
if (!pamPassword.includes('pam_pwquality') && !pwquality.includes('minlen')) {
|
|
57
|
+
findings.push(makeFinding('AC-PWD-002', 'medium', 'Password quality module not enforced', 'pam_pwquality is not configured in PAM. Password complexity is not enforced.', 'password'));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else if (os === 'darwin') {
|
|
61
|
+
const policy = await execPromise('/usr/bin/pwpolicy', ['getaccountpolicies']);
|
|
62
|
+
if (!policy.includes('policyAttributePassword')) {
|
|
63
|
+
findings.push(makeFinding('AC-PWD-003', 'medium', 'No password policy configured', 'macOS password policy is not configured via pwpolicy.', 'password'));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
logger.warn('Password policy check failed');
|
|
69
|
+
}
|
|
70
|
+
// Check for accounts without passwords (Linux)
|
|
71
|
+
if (os === 'linux') {
|
|
72
|
+
try {
|
|
73
|
+
const shadow = existsSync('/etc/shadow') ? readFileSync('/etc/shadow', 'utf-8') : '';
|
|
74
|
+
const emptyPasswords = shadow
|
|
75
|
+
.split('\n')
|
|
76
|
+
.filter((line) => {
|
|
77
|
+
const parts = line.split(':');
|
|
78
|
+
return parts[1] === '' || parts[1] === '!';
|
|
79
|
+
})
|
|
80
|
+
.map((line) => line.split(':')[0]);
|
|
81
|
+
if (emptyPasswords.length > 0) {
|
|
82
|
+
findings.push(makeFinding('AC-PWD-004', 'critical', 'Accounts without passwords', `Found ${emptyPasswords.length} account(s) with empty or disabled passwords: ${emptyPasswords.slice(0, 5).join(', ')}`, 'authentication'));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// May not have permission to read shadow
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Check sudo configuration
|
|
90
|
+
if (os !== 'win32') {
|
|
91
|
+
try {
|
|
92
|
+
const sudoers = existsSync('/etc/sudoers') ? readFileSync('/etc/sudoers', 'utf-8') : '';
|
|
93
|
+
if (sudoers.includes('NOPASSWD: ALL')) {
|
|
94
|
+
findings.push(makeFinding('AC-SUDO-001', 'high', 'NOPASSWD sudo access found', 'One or more users have NOPASSWD:ALL in sudoers, allowing passwordless root access.', 'access'));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// May not have permission
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return findings;
|
|
102
|
+
}
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// Firewall & Network Assessor
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
export async function assessFirewallAndNetwork() {
|
|
107
|
+
const findings = [];
|
|
108
|
+
// Check firewall status
|
|
109
|
+
try {
|
|
110
|
+
if (os === 'darwin') {
|
|
111
|
+
const fwStatus = await execPromise('/usr/libexec/ApplicationFirewall/socketfilterfw', [
|
|
112
|
+
'--getglobalstate',
|
|
113
|
+
]);
|
|
114
|
+
if (fwStatus.includes('disabled')) {
|
|
115
|
+
findings.push(makeFinding('FW-001', 'high', 'Firewall disabled', 'macOS Application Firewall is disabled. System is exposed to inbound connections.', 'firewall'));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else if (os === 'linux') {
|
|
119
|
+
const iptables = await execPromise('/sbin/iptables', ['-L', '-n']);
|
|
120
|
+
const ufw = await execPromise('/usr/sbin/ufw', ['status']);
|
|
121
|
+
const hasRules = iptables.split('\n').length > 8; // More than default chain headers
|
|
122
|
+
const ufwActive = ufw.includes('active');
|
|
123
|
+
if (!hasRules && !ufwActive) {
|
|
124
|
+
findings.push(makeFinding('FW-002', 'high', 'No firewall rules configured', 'Neither iptables rules nor UFW are active. System has no inbound traffic filtering.', 'firewall'));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
logger.warn('Firewall status check failed');
|
|
130
|
+
}
|
|
131
|
+
// Check for exposed services on common risky ports
|
|
132
|
+
try {
|
|
133
|
+
let openPorts = [];
|
|
134
|
+
if (os === 'darwin') {
|
|
135
|
+
const lsof = await execPromise('/usr/sbin/lsof', ['-iTCP', '-sTCP:LISTEN', '-P', '-n']);
|
|
136
|
+
openPorts = lsof
|
|
137
|
+
.split('\n')
|
|
138
|
+
.filter((l) => l.includes('LISTEN'))
|
|
139
|
+
.map((l) => {
|
|
140
|
+
const match = l.match(/:(\d+)\s/);
|
|
141
|
+
return match ? match[1] : '';
|
|
142
|
+
})
|
|
143
|
+
.filter(Boolean);
|
|
144
|
+
}
|
|
145
|
+
else if (os === 'linux') {
|
|
146
|
+
const ss = await execPromise('/usr/bin/ss', ['-tlnp']);
|
|
147
|
+
openPorts = ss
|
|
148
|
+
.split('\n')
|
|
149
|
+
.filter((l) => l.includes('LISTEN'))
|
|
150
|
+
.map((l) => {
|
|
151
|
+
const match = l.match(/:(\d+)\s/);
|
|
152
|
+
return match ? match[1] : '';
|
|
153
|
+
})
|
|
154
|
+
.filter(Boolean);
|
|
155
|
+
}
|
|
156
|
+
const riskyPorts = {
|
|
157
|
+
'21': 'FTP',
|
|
158
|
+
'23': 'Telnet',
|
|
159
|
+
'445': 'SMB',
|
|
160
|
+
'3306': 'MySQL',
|
|
161
|
+
'5432': 'PostgreSQL',
|
|
162
|
+
'6379': 'Redis',
|
|
163
|
+
'27017': 'MongoDB',
|
|
164
|
+
'11211': 'Memcached',
|
|
165
|
+
};
|
|
166
|
+
const exposedRisky = openPorts.filter((p) => riskyPorts[p]);
|
|
167
|
+
if (exposedRisky.length > 0) {
|
|
168
|
+
const services = exposedRisky.map((p) => `${riskyPorts[p]} (${p})`).join(', ');
|
|
169
|
+
findings.push(makeFinding('NET-PORT-001', 'high', 'Risky services exposed', `The following services are listening on network interfaces: ${services}. These should be firewalled or disabled.`, 'network'));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
logger.warn('Open port check failed');
|
|
174
|
+
}
|
|
175
|
+
return findings;
|
|
176
|
+
}
|
|
177
|
+
// ---------------------------------------------------------------------------
|
|
178
|
+
// Encryption & Certificate Assessor
|
|
179
|
+
// ---------------------------------------------------------------------------
|
|
180
|
+
export async function assessEncryption() {
|
|
181
|
+
const findings = [];
|
|
182
|
+
// Check disk encryption
|
|
183
|
+
try {
|
|
184
|
+
if (os === 'darwin') {
|
|
185
|
+
const fdesetup = await execPromise('/usr/bin/fdesetup', ['status']);
|
|
186
|
+
if (!fdesetup.includes('On')) {
|
|
187
|
+
findings.push(makeFinding('ENC-DISK-001', 'high', 'Disk encryption not enabled', 'FileVault is not enabled. Data at rest is not encrypted.', 'encryption'));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else if (os === 'linux') {
|
|
191
|
+
const lsblk = await execPromise('/bin/lsblk', ['-o', 'NAME,TYPE,FSTYPE']);
|
|
192
|
+
if (!lsblk.includes('crypt') && !lsblk.includes('luks')) {
|
|
193
|
+
findings.push(makeFinding('ENC-DISK-002', 'medium', 'No LUKS encryption detected', 'No LUKS-encrypted partitions found. Data at rest may not be encrypted.', 'encryption'));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
logger.warn('Disk encryption check failed');
|
|
199
|
+
}
|
|
200
|
+
// Check SSH key security
|
|
201
|
+
try {
|
|
202
|
+
const sshDir = `${process.env['HOME']}/.ssh`;
|
|
203
|
+
if (existsSync(sshDir)) {
|
|
204
|
+
const files = readdirSync(sshDir);
|
|
205
|
+
const privateKeys = files.filter((f) => f.startsWith('id_') && !f.endsWith('.pub') && !f.includes('known_hosts'));
|
|
206
|
+
for (const keyFile of privateKeys) {
|
|
207
|
+
const keyPath = `${sshDir}/${keyFile}`;
|
|
208
|
+
try {
|
|
209
|
+
const content = readFileSync(keyPath, 'utf-8');
|
|
210
|
+
if (content.includes('BEGIN RSA PRIVATE KEY') && !content.includes('ENCRYPTED')) {
|
|
211
|
+
findings.push(makeFinding(`ENC-SSH-${keyFile}`, 'medium', `Unencrypted SSH private key: ${keyFile}`, `SSH private key ${keyPath} is not passphrase-protected.`, 'encryption'));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
// Permission denied is fine
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
logger.warn('SSH key check failed');
|
|
222
|
+
}
|
|
223
|
+
return findings;
|
|
224
|
+
}
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
// Monitoring & Logging Assessor
|
|
227
|
+
// ---------------------------------------------------------------------------
|
|
228
|
+
export async function assessMonitoring() {
|
|
229
|
+
const findings = [];
|
|
230
|
+
// Check syslog / journald
|
|
231
|
+
try {
|
|
232
|
+
if (os === 'linux') {
|
|
233
|
+
const journalctl = await execPromise('/bin/journalctl', ['--disk-usage']);
|
|
234
|
+
if (!journalctl || journalctl.includes('No journal files')) {
|
|
235
|
+
findings.push(makeFinding('MON-LOG-001', 'high', 'No system logging configured', 'journald has no journal files. System events are not being recorded.', 'logging'));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else if (os === 'darwin') {
|
|
239
|
+
// macOS always has system logging via unified log
|
|
240
|
+
const logStats = await execPromise('/usr/bin/log', ['stats']);
|
|
241
|
+
if (!logStats) {
|
|
242
|
+
findings.push(makeFinding('MON-LOG-002', 'medium', 'System logging may be impaired', 'Could not verify macOS unified log status.', 'logging'));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
logger.warn('Logging check failed');
|
|
248
|
+
}
|
|
249
|
+
// Check if audit daemon is running (Linux)
|
|
250
|
+
if (os === 'linux') {
|
|
251
|
+
try {
|
|
252
|
+
const auditd = await execPromise('/bin/systemctl', ['is-active', 'auditd']);
|
|
253
|
+
if (auditd !== 'active') {
|
|
254
|
+
findings.push(makeFinding('MON-AUDIT-001', 'medium', 'Audit daemon not active', 'auditd is not running. System call auditing is not enabled.', 'audit'));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
// auditd may not be installed
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// Check if Panguard Guard is running
|
|
262
|
+
try {
|
|
263
|
+
const processes = await execPromise(os === 'win32' ? 'tasklist' : '/bin/ps', [
|
|
264
|
+
os === 'win32' ? '/FI' : 'aux',
|
|
265
|
+
...(os === 'win32' ? ['"IMAGENAME eq node.exe"'] : []),
|
|
266
|
+
]);
|
|
267
|
+
if (!processes.includes('panguard') && !processes.includes('guard')) {
|
|
268
|
+
findings.push(makeFinding('MON-GUARD-001', 'medium', 'Panguard Guard not running', 'Panguard Guard monitoring daemon is not detected. Real-time threat monitoring is inactive.', 'monitoring'));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
logger.warn('Process check failed');
|
|
273
|
+
}
|
|
274
|
+
return findings;
|
|
275
|
+
}
|
|
276
|
+
// ---------------------------------------------------------------------------
|
|
277
|
+
// Vulnerability & Patch Assessment
|
|
278
|
+
// ---------------------------------------------------------------------------
|
|
279
|
+
export async function assessPatching() {
|
|
280
|
+
const findings = [];
|
|
281
|
+
// Check for available system updates
|
|
282
|
+
try {
|
|
283
|
+
if (os === 'darwin') {
|
|
284
|
+
const updates = await execPromise('/usr/sbin/softwareupdate', ['-l'], 30000);
|
|
285
|
+
const updateCount = (updates.match(/\*/g) || []).length;
|
|
286
|
+
if (updateCount > 0) {
|
|
287
|
+
findings.push(makeFinding('PATCH-001', updateCount > 5 ? 'high' : 'medium', `${updateCount} pending system updates`, `There are ${updateCount} pending macOS software updates. Security patches should be applied promptly.`, 'vulnerability'));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else if (os === 'linux') {
|
|
291
|
+
// Check apt (Debian/Ubuntu)
|
|
292
|
+
if (existsSync('/usr/bin/apt')) {
|
|
293
|
+
const aptList = await execPromise('/usr/bin/apt', ['list', '--upgradable'], 30000);
|
|
294
|
+
const updateLines = aptList.split('\n').filter((l) => l.includes('upgradable'));
|
|
295
|
+
const secUpdates = updateLines.filter((l) => l.includes('security') || l.includes('-security'));
|
|
296
|
+
if (secUpdates.length > 0) {
|
|
297
|
+
findings.push(makeFinding('PATCH-002', secUpdates.length > 10 ? 'critical' : 'high', `${secUpdates.length} security updates pending`, `There are ${secUpdates.length} pending security updates. Apply them with: apt upgrade`, 'vulnerability'));
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
logger.warn('Patch check failed');
|
|
304
|
+
}
|
|
305
|
+
return findings;
|
|
306
|
+
}
|
|
307
|
+
// ---------------------------------------------------------------------------
|
|
308
|
+
// Incident Response Assessment
|
|
309
|
+
// ---------------------------------------------------------------------------
|
|
310
|
+
export async function assessIncidentResponse() {
|
|
311
|
+
const findings = [];
|
|
312
|
+
// Check if notification channels are configured in Panguard
|
|
313
|
+
const panguardConfig = `${process.env['HOME']}/.panguard/config.json`;
|
|
314
|
+
try {
|
|
315
|
+
if (existsSync(panguardConfig)) {
|
|
316
|
+
const config = JSON.parse(readFileSync(panguardConfig, 'utf-8'));
|
|
317
|
+
if (!config.notifications || Object.keys(config.notifications).length === 0) {
|
|
318
|
+
findings.push(makeFinding('IR-NOTIFY-001', 'medium', 'No notification channels configured', 'Panguard has no notification channels (Telegram/Slack/Email) configured. Incident alerts cannot be delivered.', 'incident'));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
findings.push(makeFinding('IR-CONFIG-001', 'low', 'Panguard not configured', 'No Panguard configuration found at ~/.panguard/config.json. Run `panguard init` to set up.', 'incident'));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
// Config may not exist
|
|
327
|
+
}
|
|
328
|
+
return findings;
|
|
329
|
+
}
|
|
330
|
+
// ---------------------------------------------------------------------------
|
|
331
|
+
// Master Assessment Runner
|
|
332
|
+
// ---------------------------------------------------------------------------
|
|
333
|
+
/** Category → Assessor function mapping */
|
|
334
|
+
const CATEGORY_ASSESSORS = {
|
|
335
|
+
// TCSA categories
|
|
336
|
+
access_control: assessAccessControl,
|
|
337
|
+
authentication: assessAccessControl,
|
|
338
|
+
system_protection: assessFirewallAndNetwork,
|
|
339
|
+
network_security: assessFirewallAndNetwork,
|
|
340
|
+
encryption: assessEncryption,
|
|
341
|
+
monitoring: assessMonitoring,
|
|
342
|
+
incident_response: assessIncidentResponse,
|
|
343
|
+
asset_management: assessPatching,
|
|
344
|
+
patch_management: assessPatching,
|
|
345
|
+
audit: assessMonitoring,
|
|
346
|
+
// SOC 2 categories
|
|
347
|
+
logical_access: assessAccessControl,
|
|
348
|
+
credentials: assessAccessControl,
|
|
349
|
+
access_management: assessAccessControl,
|
|
350
|
+
boundary_protection: assessFirewallAndNetwork,
|
|
351
|
+
data_transmission: assessEncryption,
|
|
352
|
+
anomaly_detection: assessMonitoring,
|
|
353
|
+
incident_evaluation: assessMonitoring,
|
|
354
|
+
change_management: assessPatching,
|
|
355
|
+
// ISO 27001 categories
|
|
356
|
+
technology: assessAccessControl,
|
|
357
|
+
malware: assessMonitoring,
|
|
358
|
+
vulnerability: assessPatching,
|
|
359
|
+
configuration: assessFirewallAndNetwork,
|
|
360
|
+
data_protection: assessEncryption,
|
|
361
|
+
logging: assessMonitoring,
|
|
362
|
+
network: assessFirewallAndNetwork,
|
|
363
|
+
cryptography: assessEncryption,
|
|
364
|
+
incident: assessIncidentResponse,
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* Run all assessments for a given framework's control categories.
|
|
368
|
+
* Returns deduplicated findings.
|
|
369
|
+
*/
|
|
370
|
+
export async function runAssessment(controlCategories) {
|
|
371
|
+
const allFindings = [];
|
|
372
|
+
const ranAssessors = new Set();
|
|
373
|
+
for (const category of controlCategories) {
|
|
374
|
+
const assessor = CATEGORY_ASSESSORS[category];
|
|
375
|
+
if (!assessor)
|
|
376
|
+
continue;
|
|
377
|
+
// Deduplicate: don't run the same assessor function twice
|
|
378
|
+
const assessorName = assessor.name;
|
|
379
|
+
if (ranAssessors.has(assessorName))
|
|
380
|
+
continue;
|
|
381
|
+
ranAssessors.add(assessorName);
|
|
382
|
+
logger.info(`Running assessor: ${assessorName} for category: ${category}`);
|
|
383
|
+
try {
|
|
384
|
+
const findings = await assessor();
|
|
385
|
+
allFindings.push(...findings);
|
|
386
|
+
}
|
|
387
|
+
catch (err) {
|
|
388
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
389
|
+
logger.error(`Assessor ${assessorName} failed: ${msg}`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// Deduplicate by findingId
|
|
393
|
+
const seen = new Set();
|
|
394
|
+
return allFindings.filter((f) => {
|
|
395
|
+
if (seen.has(f.findingId))
|
|
396
|
+
return false;
|
|
397
|
+
seen.add(f.findingId);
|
|
398
|
+
return true;
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Run full system assessment (all assessors).
|
|
403
|
+
*/
|
|
404
|
+
export async function runFullAssessment() {
|
|
405
|
+
const allCategories = Object.keys(CATEGORY_ASSESSORS);
|
|
406
|
+
return runAssessment(allCategories);
|
|
407
|
+
}
|
|
408
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assessors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,MAAM,MAAM,GAAG,YAAY,CAAC,2BAA2B,CAAC,CAAC;AAEzD,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;AAEtB,8EAA8E;AAC9E,UAAU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port CLI
|
|
4
|
+
* PanguardReport 命令列介面
|
|
5
|
+
*
|
|
6
|
+
* @module @panguard-ai/panguard-report/cli
|
|
7
|
+
*/
|
|
8
|
+
import type { ComplianceFramework, ReportConfig, ReportFormat, ReportLanguage } from '../types.js';
|
|
9
|
+
/** Available CLI commands / 可用的 CLI 命令 */
|
|
10
|
+
export type ReportCliCommand = 'generate' | 'list-frameworks' | 'validate' | 'summary' | 'config' | 'help';
|
|
11
|
+
/** CLI options / CLI 選項 */
|
|
12
|
+
export interface ReportCliOptions {
|
|
13
|
+
command: ReportCliCommand;
|
|
14
|
+
framework?: ComplianceFramework;
|
|
15
|
+
language?: ReportLanguage;
|
|
16
|
+
format?: ReportFormat;
|
|
17
|
+
outputDir?: string;
|
|
18
|
+
organizationName?: string;
|
|
19
|
+
inputFile?: string;
|
|
20
|
+
verbose?: boolean;
|
|
21
|
+
/** Run live system assessment / 執行即時系統評估 */
|
|
22
|
+
assess?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse CLI arguments
|
|
26
|
+
* 解析 CLI 參數
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseCliArgs(args: string[]): ReportCliOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Build report config from CLI options
|
|
31
|
+
* 從 CLI 選項建立報告配置
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildConfigFromOptions(options: ReportCliOptions): ReportConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Format config for display
|
|
36
|
+
* 格式化配置以供顯示
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatConfig(config: ReportConfig): string;
|
|
39
|
+
/**
|
|
40
|
+
* Format framework list for display
|
|
41
|
+
* 格式化框架列表以供顯示
|
|
42
|
+
*/
|
|
43
|
+
export declare function formatFrameworkList(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Get help text
|
|
46
|
+
* 取得說明文字
|
|
47
|
+
*/
|
|
48
|
+
export declare function getHelpText(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Execute CLI command
|
|
51
|
+
* 執行 CLI 命令
|
|
52
|
+
*/
|
|
53
|
+
export declare function executeCli(args: string[]): Promise<void>;
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,mBAAmB,EAEnB,YAAY,EACZ,YAAY,EACZ,cAAc,EACf,MAAM,aAAa,CAAC;AASrB,0CAA0C;AAC1C,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,SAAS,GACT,QAAQ,GACR,MAAM,CAAC;AAEX,2BAA2B;AAC3B,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAgC7D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY,CAoB9E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAgBzD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAU5C;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAkCpC;AA6CD;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuG9D"}
|