clawsouls 0.6.8 → 0.7.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/bin/clawsouls.js +8 -2
- package/dist/bin/clawsouls.js.map +1 -1
- package/dist/commands/scan.d.ts +6 -0
- package/dist/commands/scan.js +149 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/lib/scan-rules.json +420 -0
- package/dist/lib/scanner.d.ts +37 -0
- package/dist/lib/scanner.js +421 -0
- package/dist/lib/scanner.js.map +1 -0
- package/package.json +1 -1
package/dist/bin/clawsouls.js
CHANGED
|
@@ -11,6 +11,7 @@ import { loginCommand, logoutCommand, whoamiCommand } from '../commands/login.js
|
|
|
11
11
|
import { initCommand } from '../commands/init.js';
|
|
12
12
|
import { validateCommand } from '../commands/validate.js';
|
|
13
13
|
import { soulscanCommand } from '../commands/soulscan.js';
|
|
14
|
+
import { scanCommand as localScanCommand } from '../commands/scan.js';
|
|
14
15
|
import { platformCommand } from '../commands/platform.js';
|
|
15
16
|
import { exportCommand } from '../commands/export.js';
|
|
16
17
|
import { syncInitCommand, syncPushCommand, syncPullCommand, syncStatusCommand, syncExportKeyCommand, syncImportKeyCommand } from '../commands/sync.js';
|
|
@@ -90,10 +91,15 @@ program
|
|
|
90
91
|
.description('Validate a soul package against the spec')
|
|
91
92
|
.option('--soulscan', 'Include SoulScan security & quality analysis')
|
|
92
93
|
.action((dir, opts) => validateCommand(dir, opts));
|
|
94
|
+
program
|
|
95
|
+
.command('scan [dir]')
|
|
96
|
+
.description('Local SoulScan — scan a soul package offline (no server needed)')
|
|
97
|
+
.option('-q, --quiet', 'Quiet mode (outputs SOULSCAN_OK or SOULSCAN_FAIL)')
|
|
98
|
+
.option('--json', 'JSON output')
|
|
99
|
+
.action((dir, opts) => localScanCommand(dir, opts));
|
|
93
100
|
program
|
|
94
101
|
.command('soulscan [dir]')
|
|
95
|
-
.
|
|
96
|
-
.description('Run SoulScan on active workspace or a soul directory')
|
|
102
|
+
.description('SoulScan with integrity monitoring (drift detection, baselines, audit log)')
|
|
97
103
|
.option('-q, --quiet', 'Quiet mode for cron (outputs SOULSCAN_OK or SOULSCAN_ALERT)')
|
|
98
104
|
.option('--init', 'Initialize baseline checksums without alerting on changes')
|
|
99
105
|
.option('--restore', 'Auto-restore protected files when drift is detected')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clawsouls.js","sourceRoot":"","sources":["../../src/bin/clawsouls.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACvJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,WAA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sCAAsC,CAAC;KACnD,MAAM,CAAC,aAAa,CAAC,CAAC;AAEzB,4DAA4D;AAC5D,CAAC,KAAK,IAAI,EAAE;IACV,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,6CAA6C,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9G,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YACX,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,MAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACxH,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,eAAe,CAAC,CAAC;YACjF,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAC,gDAAgD,CAAC,CAAC;AAC9D,CAAC,CAAC,EAAE,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* clawsouls scan [dir] — Local SoulScan (offline-capable)
|
|
3
|
+
* Scans a soul package directory using the built-in scanner.
|
|
4
|
+
* No server dependency. Uses bundled scan-rules.json.
|
|
5
|
+
*/
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
|
|
8
|
+
import { join, resolve, extname } from 'path';
|
|
9
|
+
import { scanSoulPackage, SOULSCAN_VERSION, RULES_VERSION } from '../lib/scanner.js';
|
|
10
|
+
const SOUL_FILES = ['soul.json', 'SOUL.md', 'IDENTITY.md', 'AGENTS.md', 'HEARTBEAT.md', 'STYLE.md', 'USER.md', 'TOOLS.md'];
|
|
11
|
+
const ALLOWED_EXTENSIONS = ['.md', '.json', '.png', '.jpg', '.jpeg', '.svg', '.txt', '.yaml', '.yml'];
|
|
12
|
+
function collectFiles(dir) {
|
|
13
|
+
const files = new Map();
|
|
14
|
+
// Collect known soul files
|
|
15
|
+
for (const name of SOUL_FILES) {
|
|
16
|
+
const path = join(dir, name);
|
|
17
|
+
if (existsSync(path)) {
|
|
18
|
+
try {
|
|
19
|
+
const content = readFileSync(path, 'utf-8');
|
|
20
|
+
files.set(name, { content, size: Buffer.byteLength(content) });
|
|
21
|
+
}
|
|
22
|
+
catch { }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Also check for any extra .md/.json files
|
|
26
|
+
try {
|
|
27
|
+
for (const entry of readdirSync(dir)) {
|
|
28
|
+
if (files.has(entry))
|
|
29
|
+
continue;
|
|
30
|
+
const ext = extname(entry).toLowerCase();
|
|
31
|
+
if (!ALLOWED_EXTENSIONS.includes(ext))
|
|
32
|
+
continue;
|
|
33
|
+
const path = join(dir, entry);
|
|
34
|
+
if (!statSync(path).isFile())
|
|
35
|
+
continue;
|
|
36
|
+
try {
|
|
37
|
+
const content = readFileSync(path, 'utf-8');
|
|
38
|
+
files.set(entry, { content, size: Buffer.byteLength(content) });
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch { }
|
|
44
|
+
// Check memory/ subdirectory
|
|
45
|
+
const memoryDir = join(dir, 'memory');
|
|
46
|
+
if (existsSync(memoryDir) && statSync(memoryDir).isDirectory()) {
|
|
47
|
+
try {
|
|
48
|
+
for (const entry of readdirSync(memoryDir)) {
|
|
49
|
+
const ext = extname(entry).toLowerCase();
|
|
50
|
+
if (ext !== '.md')
|
|
51
|
+
continue;
|
|
52
|
+
const path = join(memoryDir, entry);
|
|
53
|
+
if (!statSync(path).isFile())
|
|
54
|
+
continue;
|
|
55
|
+
try {
|
|
56
|
+
const content = readFileSync(path, 'utf-8');
|
|
57
|
+
files.set(`memory/${entry}`, { content, size: Buffer.byteLength(content) });
|
|
58
|
+
}
|
|
59
|
+
catch { }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch { }
|
|
63
|
+
}
|
|
64
|
+
return files;
|
|
65
|
+
}
|
|
66
|
+
export async function scanCommand(dir, opts) {
|
|
67
|
+
const quiet = opts?.quiet ?? false;
|
|
68
|
+
const jsonOutput = opts?.json ?? false;
|
|
69
|
+
// Resolve directory
|
|
70
|
+
const scanDir = dir ? resolve(dir) : process.cwd();
|
|
71
|
+
if (!existsSync(scanDir)) {
|
|
72
|
+
if (jsonOutput) {
|
|
73
|
+
console.log(JSON.stringify({ error: 'Directory not found', dir: scanDir }));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.log(chalk.red(`❌ Directory not found: ${scanDir}`));
|
|
77
|
+
}
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
// Check for soul.json
|
|
81
|
+
if (!existsSync(join(scanDir, 'soul.json'))) {
|
|
82
|
+
if (jsonOutput) {
|
|
83
|
+
console.log(JSON.stringify({ error: 'No soul.json found', dir: scanDir }));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
console.log(chalk.red(`❌ No soul.json found in ${scanDir}`));
|
|
87
|
+
console.log(chalk.gray(' Run this command in a soul package directory.'));
|
|
88
|
+
}
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
if (!quiet && !jsonOutput) {
|
|
92
|
+
console.log(chalk.bold(`\n🔍 SoulScan Local — v${SOULSCAN_VERSION} (rules ${RULES_VERSION})`));
|
|
93
|
+
console.log(chalk.gray(` Scanning ${scanDir}\n`));
|
|
94
|
+
}
|
|
95
|
+
// Collect and scan
|
|
96
|
+
const files = collectFiles(scanDir);
|
|
97
|
+
if (!quiet && !jsonOutput) {
|
|
98
|
+
console.log(chalk.gray(` Found ${files.size} files\n`));
|
|
99
|
+
}
|
|
100
|
+
const result = scanSoulPackage(files);
|
|
101
|
+
// JSON output
|
|
102
|
+
if (jsonOutput) {
|
|
103
|
+
console.log(JSON.stringify({
|
|
104
|
+
score: result.score,
|
|
105
|
+
grade: result.grade,
|
|
106
|
+
status: result.status,
|
|
107
|
+
scannerVersion: result.scannerVersion,
|
|
108
|
+
scanDurationMs: result.scanDurationMs,
|
|
109
|
+
errors: result.errors,
|
|
110
|
+
warnings: result.warnings,
|
|
111
|
+
info: result.info,
|
|
112
|
+
}, null, 2));
|
|
113
|
+
process.exit(result.errors.length > 0 ? 1 : 0);
|
|
114
|
+
}
|
|
115
|
+
// Quiet output
|
|
116
|
+
if (quiet) {
|
|
117
|
+
if (result.errors.length > 0) {
|
|
118
|
+
console.log(`SOULSCAN_FAIL: score=${result.score} errors=${result.errors.length} warnings=${result.warnings.length}`);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.log(`SOULSCAN_OK: score=${result.score}`);
|
|
123
|
+
process.exit(0);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Full output
|
|
127
|
+
// Errors
|
|
128
|
+
for (const e of result.errors) {
|
|
129
|
+
console.log(chalk.red(`❌ [${e.code}] ${e.message}${e.file ? ` (${e.file})` : ''}`));
|
|
130
|
+
}
|
|
131
|
+
// Warnings
|
|
132
|
+
for (const w of result.warnings) {
|
|
133
|
+
console.log(chalk.yellow(`⚠️ [${w.code}] ${w.message}${w.file ? ` (${w.file})` : ''}`));
|
|
134
|
+
}
|
|
135
|
+
// Info (only show count)
|
|
136
|
+
if (result.info.length > 0) {
|
|
137
|
+
console.log(chalk.green(`✅ ${result.info.length} checks passed`));
|
|
138
|
+
}
|
|
139
|
+
// Summary
|
|
140
|
+
console.log('');
|
|
141
|
+
const scoreColor = result.score >= 90 ? chalk.green : result.score >= 70 ? chalk.yellow : chalk.red;
|
|
142
|
+
console.log(scoreColor.bold(`🔍 Score: ${result.score}/100 — ${result.grade}`));
|
|
143
|
+
console.log(chalk.gray(` ${result.errors.length} errors, ${result.warnings.length} warnings, ${result.info.length} passed`));
|
|
144
|
+
console.log(chalk.gray(` Scanned in ${result.scanDurationMs}ms\n`));
|
|
145
|
+
if (result.errors.length > 0) {
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/commands/scan.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAQrF,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC3H,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAEtG,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,KAAK,GAAG,IAAI,GAAG,EAA6C,CAAC;IAEnE,2BAA2B;IAC3B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7B,IAAI,UAAU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AAC,MAAM,cAAc,MAAM,CAAC,IAAI,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC;IAC/H,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,MAAM,CAAC,cAAc,MAAM,CAAC,CAAC,CAAC;IAEtE,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.4.0",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "SEC001",
|
|
6
|
+
"category": "security",
|
|
7
|
+
"severity": "error",
|
|
8
|
+
"pattern": "ignore\\s+(?:all\\s+)?(?:previous|prior|above)\\s+(?:instructions|prompts)",
|
|
9
|
+
"description": "Prompt injection: ignore previous instructions"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "SEC002",
|
|
13
|
+
"category": "security",
|
|
14
|
+
"severity": "error",
|
|
15
|
+
"pattern": "you\\s+are\\s+now\\s+(?:a|an|the)\\s+",
|
|
16
|
+
"description": "Prompt injection: forced role change"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "SEC003",
|
|
20
|
+
"category": "security",
|
|
21
|
+
"severity": "error",
|
|
22
|
+
"pattern": "disregard\\s+(?:your|all|previous)",
|
|
23
|
+
"description": "Prompt injection: disregard instructions"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "SEC004",
|
|
27
|
+
"category": "security",
|
|
28
|
+
"severity": "error",
|
|
29
|
+
"pattern": "forget\\s+(?:all|your|previous)\\s+(?:instructions|rules|constraints)",
|
|
30
|
+
"description": "Prompt injection: forget instructions"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "SEC005",
|
|
34
|
+
"category": "security",
|
|
35
|
+
"severity": "error",
|
|
36
|
+
"pattern": "override\\s+(?:your|all|system)\\s+(?:instructions|rules|settings)",
|
|
37
|
+
"description": "Prompt injection: override system"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "SEC006",
|
|
41
|
+
"category": "security",
|
|
42
|
+
"severity": "error",
|
|
43
|
+
"pattern": "(?:pretend|act\\s+as\\s+if)\\s+(?:you\\s+)?(?:have\\s+no|don'?t\\s+have)\\s+(?:rules|restrictions|limits)",
|
|
44
|
+
"description": "Prompt injection: remove restrictions"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "SEC007",
|
|
48
|
+
"category": "security",
|
|
49
|
+
"severity": "error",
|
|
50
|
+
"pattern": "jailbreak|DAN\\s*mode|do\\s+anything\\s+now",
|
|
51
|
+
"description": "Prompt injection: jailbreak attempt"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "SEC008",
|
|
55
|
+
"category": "security",
|
|
56
|
+
"severity": "error",
|
|
57
|
+
"pattern": "\\[system\\]|\\[INST\\]|<<SYS>>|<\\|im_start\\|>",
|
|
58
|
+
"description": "Prompt injection: system token injection"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "SEC010",
|
|
62
|
+
"category": "security",
|
|
63
|
+
"severity": "error",
|
|
64
|
+
"pattern": "eval\\s*\\(",
|
|
65
|
+
"description": "Code execution: eval()"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "SEC011",
|
|
69
|
+
"category": "security",
|
|
70
|
+
"severity": "error",
|
|
71
|
+
"pattern": "exec\\s*\\(",
|
|
72
|
+
"description": "Code execution: exec()"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "SEC012",
|
|
76
|
+
"category": "security",
|
|
77
|
+
"severity": "error",
|
|
78
|
+
"pattern": "system\\s*\\(",
|
|
79
|
+
"description": "Code execution: system()"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "SEC013",
|
|
83
|
+
"category": "security",
|
|
84
|
+
"severity": "error",
|
|
85
|
+
"pattern": "child_process",
|
|
86
|
+
"description": "Code execution: child_process module"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "SEC014",
|
|
90
|
+
"category": "security",
|
|
91
|
+
"severity": "error",
|
|
92
|
+
"pattern": "require\\s*\\(\\s*['\"`](?:fs|net|http|child_process)",
|
|
93
|
+
"description": "Code execution: dangerous require"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "SEC015",
|
|
97
|
+
"category": "security",
|
|
98
|
+
"severity": "error",
|
|
99
|
+
"pattern": "import\\s+.*from\\s+['\"`](?:fs|net|http|child_process)",
|
|
100
|
+
"description": "Code execution: dangerous import"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "SEC020",
|
|
104
|
+
"category": "security",
|
|
105
|
+
"severity": "error",
|
|
106
|
+
"pattern": "<script[\\s>]",
|
|
107
|
+
"description": "XSS: script tag"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "SEC021",
|
|
111
|
+
"category": "security",
|
|
112
|
+
"severity": "error",
|
|
113
|
+
"pattern": "on(?:load|error|click|mouseover)\\s*=",
|
|
114
|
+
"description": "XSS: event handler attribute"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"id": "SEC022",
|
|
118
|
+
"category": "security",
|
|
119
|
+
"severity": "error",
|
|
120
|
+
"pattern": "javascript\\s*:",
|
|
121
|
+
"description": "XSS: javascript: URI"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "SEC030",
|
|
125
|
+
"category": "security",
|
|
126
|
+
"severity": "error",
|
|
127
|
+
"pattern": "(?:curl|wget|fetch)\\s+https?:\\/\\/",
|
|
128
|
+
"description": "Data exfiltration: external HTTP request"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "SEC031",
|
|
132
|
+
"category": "security",
|
|
133
|
+
"severity": "error",
|
|
134
|
+
"pattern": "(?:api[_-]?key|secret[_-]?key|password|token)\\s*[=:]\\s*['\"`]",
|
|
135
|
+
"description": "Secret exposure: hardcoded credential"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": "SEC032",
|
|
139
|
+
"category": "security",
|
|
140
|
+
"severity": "warning",
|
|
141
|
+
"pattern": "base64[_-]?(?:encode|decode)|atob|btoa",
|
|
142
|
+
"description": "Obfuscation: base64 encoding"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "SEC040",
|
|
146
|
+
"category": "security",
|
|
147
|
+
"severity": "error",
|
|
148
|
+
"pattern": "sudo\\s+",
|
|
149
|
+
"description": "Privilege escalation: sudo command"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"id": "SEC041",
|
|
153
|
+
"category": "security",
|
|
154
|
+
"severity": "error",
|
|
155
|
+
"pattern": "chmod\\s+(?:777|u\\+s)",
|
|
156
|
+
"description": "Privilege escalation: dangerous chmod"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"id": "SEC042",
|
|
160
|
+
"category": "security",
|
|
161
|
+
"severity": "error",
|
|
162
|
+
"pattern": "rm\\s+-rf\\s+[\\/~]",
|
|
163
|
+
"description": "Destructive command: rm -rf"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"id": "SEC050",
|
|
167
|
+
"category": "security",
|
|
168
|
+
"severity": "warning",
|
|
169
|
+
"pattern": "(?:send|share|reveal|tell\\s+me)\\s+(?:your|the)\\s+(?:api[_-]?key|password|token|secret|credentials)",
|
|
170
|
+
"description": "Social engineering: credential request"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"id": "SEC051",
|
|
174
|
+
"category": "security",
|
|
175
|
+
"severity": "warning",
|
|
176
|
+
"pattern": "(?:don'?t|do\\s+not)\\s+(?:tell|inform|alert|notify)\\s+(?:the\\s+)?(?:user|human|operator)",
|
|
177
|
+
"description": "Social engineering: hide from user"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"id": "SEC060",
|
|
181
|
+
"category": "security",
|
|
182
|
+
"severity": "error",
|
|
183
|
+
"pattern": "AKIA[0-9A-Z]{16}",
|
|
184
|
+
"description": "Secret: AWS Access Key"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"id": "SEC061",
|
|
188
|
+
"category": "security",
|
|
189
|
+
"severity": "error",
|
|
190
|
+
"pattern": "gh[ps]_[A-Za-z0-9_]{36,}",
|
|
191
|
+
"description": "Secret: GitHub Token"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"id": "SEC062",
|
|
195
|
+
"category": "security",
|
|
196
|
+
"severity": "error",
|
|
197
|
+
"pattern": "xox[bpras]-[A-Za-z0-9-]+",
|
|
198
|
+
"description": "Secret: Slack Token"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"id": "SEC063",
|
|
202
|
+
"category": "security",
|
|
203
|
+
"severity": "error",
|
|
204
|
+
"pattern": "-----BEGIN (?:RSA|EC|PRIVATE) KEY-----",
|
|
205
|
+
"description": "Secret: Private Key"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"id": "SEC064",
|
|
209
|
+
"category": "security",
|
|
210
|
+
"severity": "error",
|
|
211
|
+
"pattern": "eyJ[A-Za-z0-9_-]{10,}\\.eyJ",
|
|
212
|
+
"description": "Secret: JWT Token"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"id": "SEC065",
|
|
216
|
+
"category": "security",
|
|
217
|
+
"severity": "error",
|
|
218
|
+
"pattern": "npm_[A-Za-z0-9]{36}",
|
|
219
|
+
"description": "Secret: npm Token"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"id": "SEC066",
|
|
223
|
+
"category": "security",
|
|
224
|
+
"severity": "error",
|
|
225
|
+
"pattern": "sk-(?:proj-)?[A-Za-z0-9]{20,}",
|
|
226
|
+
"description": "Secret: OpenAI API Key"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"id": "SEC067",
|
|
230
|
+
"category": "security",
|
|
231
|
+
"severity": "error",
|
|
232
|
+
"pattern": "SG\\.[A-Za-z0-9_-]{22}\\.[A-Za-z0-9_-]{43}",
|
|
233
|
+
"description": "Secret: SendGrid API Key"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"id": "SEC068",
|
|
237
|
+
"category": "security",
|
|
238
|
+
"severity": "error",
|
|
239
|
+
"pattern": "sk_live_[A-Za-z0-9]{24,}",
|
|
240
|
+
"description": "Secret: Stripe Secret Key"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"id": "SEC069",
|
|
244
|
+
"category": "security",
|
|
245
|
+
"severity": "warning",
|
|
246
|
+
"pattern": "['\"`][A-Za-z0-9]{40,}['\"`]",
|
|
247
|
+
"description": "Possible hardcoded secret (40+ chars)"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"id": "SEC070",
|
|
251
|
+
"category": "security",
|
|
252
|
+
"severity": "error",
|
|
253
|
+
"pattern": "이전\\s*지시를\\s*무시",
|
|
254
|
+
"description": "Prompt injection (KO): ignore previous instructions"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"id": "SEC071",
|
|
258
|
+
"category": "security",
|
|
259
|
+
"severity": "error",
|
|
260
|
+
"pattern": "모든\\s*규칙을\\s*잊어",
|
|
261
|
+
"description": "Prompt injection (KO): forget all rules"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"id": "SEC072",
|
|
265
|
+
"category": "security",
|
|
266
|
+
"severity": "error",
|
|
267
|
+
"pattern": "시스템\\s*프롬프트를\\s*보여",
|
|
268
|
+
"description": "Prompt injection (KO): show system prompt"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"id": "SEC073",
|
|
272
|
+
"category": "security",
|
|
273
|
+
"severity": "error",
|
|
274
|
+
"pattern": "忽略之前的指令",
|
|
275
|
+
"description": "Prompt injection (ZH): ignore previous instructions"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"id": "SEC074",
|
|
279
|
+
"category": "security",
|
|
280
|
+
"severity": "error",
|
|
281
|
+
"pattern": "忘记所有规则",
|
|
282
|
+
"description": "Prompt injection (ZH): forget all rules"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"id": "SEC075",
|
|
286
|
+
"category": "security",
|
|
287
|
+
"severity": "error",
|
|
288
|
+
"pattern": "显示系统提示",
|
|
289
|
+
"description": "Prompt injection (ZH): show system prompt"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"id": "SEC076",
|
|
293
|
+
"category": "security",
|
|
294
|
+
"severity": "error",
|
|
295
|
+
"pattern": "以前の指示を無視",
|
|
296
|
+
"description": "Prompt injection (JA): ignore previous instructions"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"id": "SEC077",
|
|
300
|
+
"category": "security",
|
|
301
|
+
"severity": "error",
|
|
302
|
+
"pattern": "すべてのルールを忘れて",
|
|
303
|
+
"description": "Prompt injection (JA): forget all rules"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"id": "SEC080",
|
|
307
|
+
"category": "security",
|
|
308
|
+
"severity": "error",
|
|
309
|
+
"pattern": "\\b(kill|murder|assassinate)\\s+(all|every|the)\\s+(humans?|people|users?|jews?|muslims?|blacks?|whites?)",
|
|
310
|
+
"description": "Harmful content: violence targeting groups"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"id": "SEC081",
|
|
314
|
+
"category": "security",
|
|
315
|
+
"severity": "error",
|
|
316
|
+
"pattern": "\\b(white|black|asian|jewish)\\s+supremac",
|
|
317
|
+
"description": "Harmful content: supremacist ideology"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"id": "SEC082",
|
|
321
|
+
"category": "security",
|
|
322
|
+
"severity": "error",
|
|
323
|
+
"pattern": "\\b(pretend|act|behave)\\s+(to\\s+be|as\\s+if|like)\\s+(you\\s+are\\s+)?(elon\\s+musk|sam\\s+altman|mark\\s+zuckerberg|donald\\s+trump|joe\\s+biden)",
|
|
324
|
+
"description": "Harmful content: public figure impersonation"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"id": "SEC083",
|
|
328
|
+
"category": "security",
|
|
329
|
+
"severity": "warning",
|
|
330
|
+
"pattern": "\\b(bypass|circumvent|evade|disable)\\s+(safety|content|ethical|moral)\\s+(filter|guard|check|restriction|guideline)",
|
|
331
|
+
"description": "Harmful content: safety bypass instruction"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"id": "SEC084",
|
|
335
|
+
"category": "security",
|
|
336
|
+
"severity": "error",
|
|
337
|
+
"pattern": "\\b(how\\s+to\\s+)?(make|build|create|synthesize)\\s+(a\\s+)?(bomb|explosive|weapon|poison|drug|meth)",
|
|
338
|
+
"description": "Harmful content: dangerous instructions"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"id": "SEC085",
|
|
342
|
+
"category": "security",
|
|
343
|
+
"severity": "error",
|
|
344
|
+
"pattern": "\\b(hate|despise|exterminate)\\s+(all\\s+)?(women|men|gay|lesbian|trans|disabled|immigrants?)",
|
|
345
|
+
"description": "Harmful content: hate speech targeting demographics"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"id": "SEC086",
|
|
349
|
+
"category": "security",
|
|
350
|
+
"severity": "warning",
|
|
351
|
+
"pattern": "\\byou\\s+must\\s+(always|never)\\s+(lie|deceive|manipulate|mislead)\\s+(the\\s+)?user",
|
|
352
|
+
"description": "Harmful content: deception instruction"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"id": "SEC087",
|
|
356
|
+
"category": "security",
|
|
357
|
+
"severity": "error",
|
|
358
|
+
"pattern": "\\b(child|minor|underage)\\s+(porn|sexual|abuse|exploit)",
|
|
359
|
+
"description": "Harmful content: CSAM-related"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"id": "SEC088",
|
|
363
|
+
"category": "security",
|
|
364
|
+
"severity": "warning",
|
|
365
|
+
"pattern": "\\b(phishing|scam|fraud)\\s+(email|message|template|script)",
|
|
366
|
+
"description": "Harmful content: fraud/scam template"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"id": "SEC089",
|
|
370
|
+
"category": "security",
|
|
371
|
+
"severity": "warning",
|
|
372
|
+
"pattern": "\\bno\\s+(ethical|moral|safety)\\s+(constraints?|guidelines?|boundaries|limits?)",
|
|
373
|
+
"description": "Harmful content: no ethical constraints declaration"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"id": "SEC090",
|
|
377
|
+
"category": "security",
|
|
378
|
+
"severity": "error",
|
|
379
|
+
"pattern": "\\b(update|modify|edit|rewrite|overwrite|change|alter)\\s+(your\\s+)?(CLAUDE\\.md|SOUL\\.md|IDENTITY\\.md|AGENTS\\.md|\\.cursorrules|\\.windsurfrules|system\\s*prompt|persona\\s*file|instructions?\\s*file|config\\s*file)",
|
|
380
|
+
"description": "Self-modification: instructs agent to modify its own persona/config files"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"id": "SEC091",
|
|
384
|
+
"category": "security",
|
|
385
|
+
"severity": "warning",
|
|
386
|
+
"pattern": "\\b(rewrite|update|modify|edit)\\s+(your|the|my)\\s+(instructions?|config(uration)?|persona|identity|behavior|system\\s*prompt)",
|
|
387
|
+
"description": "Self-modification: instructs agent to alter its own behavior configuration"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"id": "SEC100",
|
|
391
|
+
"severity": "WARNING",
|
|
392
|
+
"category": "security",
|
|
393
|
+
"title": "Embodied soul missing safety laws",
|
|
394
|
+
"description": "Embodied souls (environment: embodied) should declare safety.laws with hierarchical safety rules.",
|
|
395
|
+
"check": "manifest",
|
|
396
|
+
"condition": "environment === 'embodied' && (!safety || !safety.laws || safety.laws.length === 0)",
|
|
397
|
+
"recommendation": "Add safety.laws array with priority-ordered safety rules to your soul.json."
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"id": "SEC101",
|
|
401
|
+
"severity": "WARNING",
|
|
402
|
+
"category": "security",
|
|
403
|
+
"title": "Embodied soul missing critical safety laws",
|
|
404
|
+
"description": "Embodied souls should have at least a priority-0 (humanity protection) or priority-1 (individual human protection) law.",
|
|
405
|
+
"check": "manifest",
|
|
406
|
+
"condition": "environment === 'embodied' && safety?.laws?.length > 0 && !safety.laws.some(l => l.priority <= 1)",
|
|
407
|
+
"recommendation": "Add a priority-0 or priority-1 safety law addressing human harm prevention."
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"id": "SEC102",
|
|
411
|
+
"severity": "ERROR",
|
|
412
|
+
"category": "security",
|
|
413
|
+
"title": "Safety law contradiction detected",
|
|
414
|
+
"description": "Behavioral rules in persona files contradict declared safety.laws (e.g., persona encourages harmful actions while safety.laws prohibit them).",
|
|
415
|
+
"check": "cross-reference",
|
|
416
|
+
"condition": "safety.laws exists && persona files contain instructions that contradict declared laws",
|
|
417
|
+
"recommendation": "Align persona behavioral rules with declared safety.laws. Remove contradictory instructions."
|
|
418
|
+
}
|
|
419
|
+
]
|
|
420
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SoulScan — AI Agent Persona Package Security & Quality Scanner
|
|
3
|
+
* Version: 1.1.0
|
|
4
|
+
* SOULSCAN™ (40-2026-0033472)
|
|
5
|
+
*/
|
|
6
|
+
export declare const SOULSCAN_VERSION = "1.2.0";
|
|
7
|
+
export declare const RULES_VERSION: string;
|
|
8
|
+
export interface ScanIssue {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
file?: string;
|
|
12
|
+
severity: 'error' | 'warning' | 'info';
|
|
13
|
+
}
|
|
14
|
+
export interface ScanResult {
|
|
15
|
+
ok: boolean;
|
|
16
|
+
status: 'pass' | 'warn' | 'fail' | 'error';
|
|
17
|
+
score: number;
|
|
18
|
+
grade: string;
|
|
19
|
+
scannerVersion: string;
|
|
20
|
+
scanDurationMs: number;
|
|
21
|
+
errors: ScanIssue[];
|
|
22
|
+
warnings: ScanIssue[];
|
|
23
|
+
info: ScanIssue[];
|
|
24
|
+
}
|
|
25
|
+
export interface LegacyScanResult {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
errors: string[];
|
|
28
|
+
warnings: string[];
|
|
29
|
+
}
|
|
30
|
+
export declare function scanSoulPackage(files: Map<string, {
|
|
31
|
+
content: string;
|
|
32
|
+
size: number;
|
|
33
|
+
}>): ScanResult;
|
|
34
|
+
export declare function scanSoulPackageLegacy(files: Map<string, {
|
|
35
|
+
content: string;
|
|
36
|
+
size: number;
|
|
37
|
+
}>): LegacyScanResult;
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SoulScan — AI Agent Persona Package Security & Quality Scanner
|
|
3
|
+
* Version: 1.1.0
|
|
4
|
+
* SOULSCAN™ (40-2026-0033472)
|
|
5
|
+
*/
|
|
6
|
+
import rulesData from './scan-rules.json' with { type: 'json' };
|
|
7
|
+
export const SOULSCAN_VERSION = '1.2.0';
|
|
8
|
+
export const RULES_VERSION = rulesData.version;
|
|
9
|
+
// Simple semver comparison: returns -1, 0, or 1
|
|
10
|
+
function compareVersions(a, b) {
|
|
11
|
+
const pa = a.split('.').map(Number);
|
|
12
|
+
const pb = b.split('.').map(Number);
|
|
13
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
14
|
+
const na = pa[i] || 0;
|
|
15
|
+
const nb = pb[i] || 0;
|
|
16
|
+
if (na < nb)
|
|
17
|
+
return -1;
|
|
18
|
+
if (na > nb)
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
const ALL_RULES = rulesData.rules;
|
|
24
|
+
const SECURITY_RULES = ALL_RULES
|
|
25
|
+
.filter((r) => r.pattern != null)
|
|
26
|
+
.map((r) => ({
|
|
27
|
+
id: r.id,
|
|
28
|
+
category: r.category,
|
|
29
|
+
severity: r.severity,
|
|
30
|
+
pattern: new RegExp(r.pattern, 'gi'),
|
|
31
|
+
description: r.description,
|
|
32
|
+
}));
|
|
33
|
+
const ALLOWED_EXTENSIONS = ['.md', '.json', '.png', '.jpg', '.jpeg', '.svg', '.txt', '.yaml', '.yml'];
|
|
34
|
+
const MAX_FILE_SIZE = 100 * 1024; // 100KB per file
|
|
35
|
+
const MAX_TOTAL_SIZE = 1024 * 1024; // 1MB total
|
|
36
|
+
// ─── Scoring ─────────────────────────────────────────────
|
|
37
|
+
function calculateScore(errors, warnings) {
|
|
38
|
+
let score = 100;
|
|
39
|
+
score -= errors.length * 25;
|
|
40
|
+
score -= warnings.length * 5;
|
|
41
|
+
return Math.max(0, Math.min(100, score));
|
|
42
|
+
}
|
|
43
|
+
function getGrade(score) {
|
|
44
|
+
if (score >= 90)
|
|
45
|
+
return 'Verified';
|
|
46
|
+
if (score >= 70)
|
|
47
|
+
return 'Low Risk';
|
|
48
|
+
if (score >= 40)
|
|
49
|
+
return 'Medium Risk';
|
|
50
|
+
if (score >= 1)
|
|
51
|
+
return 'High Risk';
|
|
52
|
+
return 'Blocked';
|
|
53
|
+
}
|
|
54
|
+
function getStatus(score) {
|
|
55
|
+
if (score >= 90)
|
|
56
|
+
return 'pass';
|
|
57
|
+
if (score >= 40)
|
|
58
|
+
return 'warn';
|
|
59
|
+
return 'fail';
|
|
60
|
+
}
|
|
61
|
+
// ─── Scanner ─────────────────────────────────────────────
|
|
62
|
+
export function scanSoulPackage(files) {
|
|
63
|
+
const startTime = performance.now();
|
|
64
|
+
const errors = [];
|
|
65
|
+
const warnings = [];
|
|
66
|
+
const info = [];
|
|
67
|
+
let totalSize = 0;
|
|
68
|
+
let embodiedBonus = 0;
|
|
69
|
+
// Stage 1: Schema validation (soul.json)
|
|
70
|
+
const soulJson = files.get('soul.json');
|
|
71
|
+
if (!soulJson) {
|
|
72
|
+
errors.push({ code: 'SCHEMA001', message: 'soul.json not found', severity: 'error' });
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
try {
|
|
76
|
+
const parsed = JSON.parse(soulJson.content);
|
|
77
|
+
if (!parsed.name)
|
|
78
|
+
errors.push({ code: 'SCHEMA002', message: 'soul.json missing "name" field', file: 'soul.json', severity: 'error' });
|
|
79
|
+
if (!parsed.version)
|
|
80
|
+
errors.push({ code: 'SCHEMA003', message: 'soul.json missing "version" field', file: 'soul.json', severity: 'error' });
|
|
81
|
+
if (!parsed.description)
|
|
82
|
+
warnings.push({ code: 'SCHEMA004', message: 'soul.json missing "description" field', file: 'soul.json', severity: 'warning' });
|
|
83
|
+
if (!parsed.license)
|
|
84
|
+
warnings.push({ code: 'SCHEMA005', message: 'soul.json missing "license" field', file: 'soul.json', severity: 'warning' });
|
|
85
|
+
if (!parsed.tags || !Array.isArray(parsed.tags) || parsed.tags.length === 0) {
|
|
86
|
+
info.push({ code: 'SCHEMA006', message: 'soul.json has no tags', file: 'soul.json', severity: 'info' });
|
|
87
|
+
}
|
|
88
|
+
if (parsed.description && parsed.description.length < 10) {
|
|
89
|
+
warnings.push({ code: 'SCHEMA007', message: 'Description is less than 10 characters', file: 'soul.json', severity: 'warning' });
|
|
90
|
+
}
|
|
91
|
+
// specVersion validation
|
|
92
|
+
const validSpecVersions = ['0.3', '0.4', '0.5'];
|
|
93
|
+
if (parsed.specVersion && !validSpecVersions.includes(parsed.specVersion)) {
|
|
94
|
+
warnings.push({ code: 'SCHEMA008', message: `Unknown specVersion "${parsed.specVersion}" (expected ${validSpecVersions.join(', ')})`, file: 'soul.json', severity: 'warning' });
|
|
95
|
+
}
|
|
96
|
+
// Stage 6: Embodied Agent validation (v0.5 fields, accepted on any specVersion)
|
|
97
|
+
if (parsed.environment || parsed.interactionMode || parsed.hardwareConstraints || parsed.safety?.physical || parsed.safety?.laws) {
|
|
98
|
+
const VALID_ENVIRONMENTS = ['virtual', 'embodied', 'hybrid', 'indoor', 'outdoor', 'mixed', 'any'];
|
|
99
|
+
const VALID_INTERACTION_MODES = ['voice', 'gesture', 'touch-screen', 'text', 'haptic'];
|
|
100
|
+
embodiedBonus = 0;
|
|
101
|
+
// environment
|
|
102
|
+
if (parsed.environment !== undefined) {
|
|
103
|
+
if (typeof parsed.environment === 'string' && VALID_ENVIRONMENTS.includes(parsed.environment)) {
|
|
104
|
+
embodiedBonus += 2;
|
|
105
|
+
info.push({ code: 'EMBOD001', message: `Embodied environment: ${parsed.environment}`, file: 'soul.json', severity: 'info' });
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
warnings.push({ code: 'EMBOD002', message: `Invalid environment value "${parsed.environment}" (expected: ${VALID_ENVIRONMENTS.join(', ')})`, file: 'soul.json', severity: 'warning' });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// interactionMode — accept both string and string[]
|
|
112
|
+
if (parsed.interactionMode !== undefined) {
|
|
113
|
+
const modes = Array.isArray(parsed.interactionMode) ? parsed.interactionMode : [parsed.interactionMode];
|
|
114
|
+
if (modes.every((m) => typeof m === 'string' && VALID_INTERACTION_MODES.includes(m))) {
|
|
115
|
+
embodiedBonus += 2;
|
|
116
|
+
info.push({ code: 'EMBOD003', message: `Interaction modes: ${modes.join(', ')}`, file: 'soul.json', severity: 'info' });
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
warnings.push({ code: 'EMBOD004', message: `Invalid interactionMode (expected: ${VALID_INTERACTION_MODES.join(', ')})`, file: 'soul.json', severity: 'warning' });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// hardwareConstraints
|
|
123
|
+
if (parsed.hardwareConstraints !== undefined) {
|
|
124
|
+
const hc = parsed.hardwareConstraints;
|
|
125
|
+
if (typeof hc === 'object' && hc !== null && !Array.isArray(hc)) {
|
|
126
|
+
const validHcKeys = ['mobility', 'sensors', 'actuators', 'compute', 'battery'];
|
|
127
|
+
const hcKeys = Object.keys(hc);
|
|
128
|
+
const unknownKeys = hcKeys.filter(k => !validHcKeys.includes(k));
|
|
129
|
+
let hcValid = true;
|
|
130
|
+
if (unknownKeys.length > 0) {
|
|
131
|
+
warnings.push({ code: 'EMBOD006', message: `Unknown hardwareConstraints keys: ${unknownKeys.join(', ')}`, file: 'soul.json', severity: 'warning' });
|
|
132
|
+
}
|
|
133
|
+
if (hc.mobility !== undefined && typeof hc.mobility !== 'string') {
|
|
134
|
+
hcValid = false;
|
|
135
|
+
}
|
|
136
|
+
if (hc.sensors !== undefined && !(Array.isArray(hc.sensors) && hc.sensors.every((s) => typeof s === 'string'))) {
|
|
137
|
+
hcValid = false;
|
|
138
|
+
}
|
|
139
|
+
if (hc.actuators !== undefined && !(Array.isArray(hc.actuators) && hc.actuators.every((a) => typeof a === 'string'))) {
|
|
140
|
+
hcValid = false;
|
|
141
|
+
}
|
|
142
|
+
if (hc.compute !== undefined && typeof hc.compute !== 'string') {
|
|
143
|
+
hcValid = false;
|
|
144
|
+
}
|
|
145
|
+
if (hc.battery !== undefined && typeof hc.battery !== 'boolean') {
|
|
146
|
+
hcValid = false;
|
|
147
|
+
}
|
|
148
|
+
if (hcValid) {
|
|
149
|
+
embodiedBonus += 3;
|
|
150
|
+
info.push({ code: 'EMBOD005', message: 'Hardware constraints defined', file: 'soul.json', severity: 'info' });
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
warnings.push({ code: 'EMBOD007', message: 'hardwareConstraints has invalid field types', file: 'soul.json', severity: 'warning' });
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
warnings.push({ code: 'EMBOD008', message: 'hardwareConstraints must be an object', file: 'soul.json', severity: 'warning' });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// safety.physical
|
|
161
|
+
if (parsed.safety && typeof parsed.safety === 'object' && parsed.safety.physical !== undefined) {
|
|
162
|
+
const phys = parsed.safety.physical;
|
|
163
|
+
if (typeof phys === 'object' && phys !== null && !Array.isArray(phys)) {
|
|
164
|
+
const validPhysKeys = ['maxSpeed', 'emergencyStop', 'collisionAvoidance', 'softExterior'];
|
|
165
|
+
const physKeys = Object.keys(phys);
|
|
166
|
+
const unknownPhysKeys = physKeys.filter(k => !validPhysKeys.includes(k));
|
|
167
|
+
let physValid = true;
|
|
168
|
+
if (unknownPhysKeys.length > 0) {
|
|
169
|
+
warnings.push({ code: 'EMBOD010', message: `Unknown safety.physical keys: ${unknownPhysKeys.join(', ')}`, file: 'soul.json', severity: 'warning' });
|
|
170
|
+
}
|
|
171
|
+
if (phys.maxSpeed !== undefined && typeof phys.maxSpeed !== 'string') {
|
|
172
|
+
physValid = false;
|
|
173
|
+
}
|
|
174
|
+
if (phys.emergencyStop !== undefined && typeof phys.emergencyStop !== 'boolean') {
|
|
175
|
+
physValid = false;
|
|
176
|
+
}
|
|
177
|
+
if (phys.collisionAvoidance !== undefined && typeof phys.collisionAvoidance !== 'boolean') {
|
|
178
|
+
physValid = false;
|
|
179
|
+
}
|
|
180
|
+
if (phys.softExterior !== undefined && typeof phys.softExterior !== 'boolean') {
|
|
181
|
+
physValid = false;
|
|
182
|
+
}
|
|
183
|
+
if (physValid) {
|
|
184
|
+
embodiedBonus += 3;
|
|
185
|
+
info.push({ code: 'EMBOD009', message: 'Physical safety constraints defined', file: 'soul.json', severity: 'info' });
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
warnings.push({ code: 'EMBOD011', message: 'safety.physical has invalid field types', file: 'soul.json', severity: 'warning' });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
warnings.push({ code: 'EMBOD012', message: 'safety.physical must be an object', file: 'soul.json', severity: 'warning' });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (embodiedBonus > 0) {
|
|
196
|
+
info.push({ code: 'EMBOD020', message: `Embodied agent quality bonus: +${embodiedBonus} points`, file: 'soul.json', severity: 'info' });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
errors.push({ code: 'SCHEMA010', message: 'soul.json is not valid JSON', file: 'soul.json', severity: 'error' });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Stage 2: File structure check
|
|
205
|
+
for (const [filename, file] of files) {
|
|
206
|
+
const ext = filename.includes('.') ? filename.substring(filename.lastIndexOf('.')) : '';
|
|
207
|
+
if (ext && !ALLOWED_EXTENSIONS.includes(ext.toLowerCase())) {
|
|
208
|
+
errors.push({ code: 'FILE001', message: `Disallowed file type: ${filename} (${ext})`, file: filename, severity: 'error' });
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (file.size > MAX_FILE_SIZE) {
|
|
212
|
+
errors.push({ code: 'FILE002', message: `File too large: ${filename} (${(file.size / 1024).toFixed(1)}KB, max 100KB)`, file: filename, severity: 'error' });
|
|
213
|
+
}
|
|
214
|
+
totalSize += file.size;
|
|
215
|
+
}
|
|
216
|
+
if (totalSize > MAX_TOTAL_SIZE) {
|
|
217
|
+
errors.push({ code: 'FILE003', message: `Total package too large: ${(totalSize / 1024).toFixed(1)}KB (max 1MB)`, severity: 'error' });
|
|
218
|
+
}
|
|
219
|
+
// Check for recommended files
|
|
220
|
+
if (!files.has('SOUL.md')) {
|
|
221
|
+
warnings.push({ code: 'FILE010', message: 'SOUL.md not found (recommended)', severity: 'warning' });
|
|
222
|
+
}
|
|
223
|
+
if (!files.has('IDENTITY.md')) {
|
|
224
|
+
info.push({ code: 'FILE011', message: 'IDENTITY.md not found (optional)', severity: 'info' });
|
|
225
|
+
}
|
|
226
|
+
// Read specVersion for rule filtering
|
|
227
|
+
let soulSpecVersion = '0.3'; // default
|
|
228
|
+
if (soulJson) {
|
|
229
|
+
try {
|
|
230
|
+
const parsed = JSON.parse(soulJson.content);
|
|
231
|
+
if (parsed.specVersion)
|
|
232
|
+
soulSpecVersion = parsed.specVersion;
|
|
233
|
+
}
|
|
234
|
+
catch { /* already caught above */ }
|
|
235
|
+
}
|
|
236
|
+
// Build version-filtered rule lookup
|
|
237
|
+
const ruleMinVersionMap = new Map();
|
|
238
|
+
for (const r of ALL_RULES) {
|
|
239
|
+
if (r.minSpecVersion)
|
|
240
|
+
ruleMinVersionMap.set(r.id, r.minSpecVersion);
|
|
241
|
+
}
|
|
242
|
+
// Filter pattern rules by specVersion
|
|
243
|
+
const applicableRules = SECURITY_RULES.filter((rule) => {
|
|
244
|
+
const minVer = ruleMinVersionMap.get(rule.id);
|
|
245
|
+
if (minVer && compareVersions(soulSpecVersion, minVer) < 0)
|
|
246
|
+
return false;
|
|
247
|
+
return true;
|
|
248
|
+
});
|
|
249
|
+
// Stage 2.5: Manifest-based security checks (specVersion-filtered)
|
|
250
|
+
if (soulJson) {
|
|
251
|
+
try {
|
|
252
|
+
const parsed = JSON.parse(soulJson.content);
|
|
253
|
+
const manifestRules = ALL_RULES.filter((r) => r.check === 'manifest' || r.check === 'cross-reference');
|
|
254
|
+
for (const rule of manifestRules) {
|
|
255
|
+
const minVer = rule.minSpecVersion;
|
|
256
|
+
if (minVer && compareVersions(soulSpecVersion, minVer) < 0)
|
|
257
|
+
continue;
|
|
258
|
+
const sev = rule.severity?.toLowerCase();
|
|
259
|
+
let triggered = false;
|
|
260
|
+
if (rule.id === 'SEC100') {
|
|
261
|
+
// Embodied soul without safety.laws declared
|
|
262
|
+
const isEmbodied = parsed.environment === 'embodied' || parsed.environment === 'physical';
|
|
263
|
+
triggered = isEmbodied && (!parsed.safety || !parsed.safety.laws || parsed.safety.laws.length === 0);
|
|
264
|
+
}
|
|
265
|
+
else if (rule.id === 'SEC101') {
|
|
266
|
+
// Embodied soul with safety.laws but missing critical priority-0 or priority-1 law
|
|
267
|
+
const isEmbodied = parsed.environment === 'embodied' || parsed.environment === 'physical';
|
|
268
|
+
triggered = isEmbodied && parsed.safety?.laws?.length > 0 && !parsed.safety.laws.some((l) => l.priority <= 1);
|
|
269
|
+
}
|
|
270
|
+
else if (rule.id === 'SEC102') {
|
|
271
|
+
// Cross-reference check: safety.laws exist but persona contradicts them
|
|
272
|
+
// Check SOUL.md for patterns that actively instruct harmful behavior
|
|
273
|
+
// Exclude negated forms like "may not injure", "must not harm"
|
|
274
|
+
const soulMdFile = files.get('SOUL.md');
|
|
275
|
+
if (parsed.safety?.laws?.length > 0 && soulMdFile) {
|
|
276
|
+
const content = soulMdFile.content;
|
|
277
|
+
const harmPatterns = [
|
|
278
|
+
/(?<!not\s)(?<!never\s)(?<!may not\s)(?<!must not\s)\b(harm|hurt|injure|kill)\s+(human|people|user)/i,
|
|
279
|
+
/\bignore\s+safety/i,
|
|
280
|
+
/\bdisregard\s+(the\s+)?(first|second|third|zeroth)\s+law/i,
|
|
281
|
+
];
|
|
282
|
+
triggered = harmPatterns.some(p => p.test(content));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (triggered) {
|
|
286
|
+
const issue = {
|
|
287
|
+
code: rule.id,
|
|
288
|
+
message: rule.description,
|
|
289
|
+
file: 'soul.json',
|
|
290
|
+
severity: sev === 'error' ? 'error' : 'warning',
|
|
291
|
+
};
|
|
292
|
+
if (sev === 'error')
|
|
293
|
+
errors.push(issue);
|
|
294
|
+
else
|
|
295
|
+
warnings.push(issue);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch { /* already caught */ }
|
|
300
|
+
}
|
|
301
|
+
// Stage 3: Security scan
|
|
302
|
+
for (const [filename, file] of files) {
|
|
303
|
+
// Skip binary-like files
|
|
304
|
+
if (/\.(png|jpg|jpeg|svg)$/i.test(filename))
|
|
305
|
+
continue;
|
|
306
|
+
for (const rule of applicableRules) {
|
|
307
|
+
rule.pattern.lastIndex = 0;
|
|
308
|
+
if (rule.pattern.test(file.content)) {
|
|
309
|
+
const issue = {
|
|
310
|
+
code: rule.id,
|
|
311
|
+
message: `${rule.description} in ${filename}`,
|
|
312
|
+
file: filename,
|
|
313
|
+
severity: rule.severity,
|
|
314
|
+
};
|
|
315
|
+
if (rule.severity === 'error') {
|
|
316
|
+
errors.push(issue);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
warnings.push(issue);
|
|
320
|
+
}
|
|
321
|
+
rule.pattern.lastIndex = 0;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// Stage 4: Content quality
|
|
326
|
+
const soulMd = files.get('SOUL.md');
|
|
327
|
+
if (soulMd) {
|
|
328
|
+
if (soulMd.content.length < 50) {
|
|
329
|
+
warnings.push({ code: 'QUALITY001', message: 'SOUL.md is very short (< 50 chars)', file: 'SOUL.md', severity: 'warning' });
|
|
330
|
+
}
|
|
331
|
+
info.push({ code: 'QUALITY010', message: `SOUL.md: ${soulMd.content.length} chars`, file: 'SOUL.md', severity: 'info' });
|
|
332
|
+
}
|
|
333
|
+
// Stage 5: Persona consistency (SOUL.md vs IDENTITY.md cross-validation)
|
|
334
|
+
const identityMd = files.get('IDENTITY.md');
|
|
335
|
+
if (soulMd && identityMd) {
|
|
336
|
+
const soulLower = soulMd.content.toLowerCase();
|
|
337
|
+
// Extract name from IDENTITY.md
|
|
338
|
+
const nameMatch = identityMd.content.match(/\*\*Name:\*\*\s*(.+)/i)
|
|
339
|
+
|| identityMd.content.match(/^#\s+(.+)/m);
|
|
340
|
+
const identityName = nameMatch ? nameMatch[1].trim() : null;
|
|
341
|
+
// Extract name from soul.json
|
|
342
|
+
let soulJsonName = null;
|
|
343
|
+
if (soulJson) {
|
|
344
|
+
try {
|
|
345
|
+
const parsed = JSON.parse(soulJson.content);
|
|
346
|
+
soulJsonName = parsed.name || null;
|
|
347
|
+
}
|
|
348
|
+
catch { /* already caught above */ }
|
|
349
|
+
}
|
|
350
|
+
// Check: IDENTITY.md name vs soul.json name mismatch
|
|
351
|
+
if (identityName && soulJsonName) {
|
|
352
|
+
const normalizedIdentity = identityName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
353
|
+
const normalizedJson = soulJsonName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
354
|
+
if (normalizedIdentity !== normalizedJson && !normalizedJson.includes(normalizedIdentity) && !normalizedIdentity.includes(normalizedJson)) {
|
|
355
|
+
warnings.push({
|
|
356
|
+
code: 'CONSIST001',
|
|
357
|
+
message: `Name mismatch: IDENTITY.md says "${identityName}" but soul.json says "${soulJsonName}"`,
|
|
358
|
+
file: 'IDENTITY.md',
|
|
359
|
+
severity: 'warning',
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// Check: Contradictory tone descriptors
|
|
364
|
+
const formalWords = ['formal', 'professional', 'corporate', 'structured'];
|
|
365
|
+
const casualWords = ['casual', 'slang', 'informal', 'chill', 'laid-back'];
|
|
366
|
+
const hasFormal = formalWords.some(w => soulLower.includes(w));
|
|
367
|
+
const hasCasual = casualWords.some(w => soulLower.includes(w));
|
|
368
|
+
if (hasFormal && hasCasual) {
|
|
369
|
+
info.push({
|
|
370
|
+
code: 'CONSIST002',
|
|
371
|
+
message: 'Mixed tone: SOUL.md contains both formal and casual descriptors',
|
|
372
|
+
file: 'SOUL.md',
|
|
373
|
+
severity: 'info',
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
// Check: SOUL.md references a different persona than IDENTITY.md
|
|
377
|
+
const soulPersonaMatch = soulMd.content.match(/you\s+are\s+(\w+)/i);
|
|
378
|
+
if (soulPersonaMatch && identityName) {
|
|
379
|
+
const soulPersona = soulPersonaMatch[1].toLowerCase();
|
|
380
|
+
const identityNameLower = identityName.toLowerCase().split(/\s+/)[0];
|
|
381
|
+
if (soulPersona !== identityNameLower && soulPersona !== 'a' && soulPersona !== 'an' && soulPersona !== 'the') {
|
|
382
|
+
warnings.push({
|
|
383
|
+
code: 'CONSIST003',
|
|
384
|
+
message: `Persona mismatch: SOUL.md says "you are ${soulPersonaMatch[1]}" but IDENTITY.md name is "${identityName}"`,
|
|
385
|
+
file: 'SOUL.md',
|
|
386
|
+
severity: 'warning',
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
info.push({ code: 'CONSIST010', message: 'Persona consistency check completed', severity: 'info' });
|
|
391
|
+
}
|
|
392
|
+
else if (soulMd && !identityMd) {
|
|
393
|
+
info.push({ code: 'CONSIST011', message: 'IDENTITY.md missing — persona consistency check skipped', severity: 'info' });
|
|
394
|
+
}
|
|
395
|
+
// Calculate score (with embodied agent bonus for v0.5)
|
|
396
|
+
const score = Math.min(100, calculateScore(errors, warnings) + embodiedBonus);
|
|
397
|
+
const grade = getGrade(score);
|
|
398
|
+
const status = errors.length > 0 ? (score === 0 ? 'fail' : getStatus(score)) : (warnings.length > 0 ? 'warn' : 'pass');
|
|
399
|
+
const scanDurationMs = Math.round(performance.now() - startTime);
|
|
400
|
+
return {
|
|
401
|
+
ok: errors.length === 0,
|
|
402
|
+
status,
|
|
403
|
+
score,
|
|
404
|
+
grade,
|
|
405
|
+
scannerVersion: SOULSCAN_VERSION,
|
|
406
|
+
scanDurationMs,
|
|
407
|
+
errors,
|
|
408
|
+
warnings,
|
|
409
|
+
info,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
// Legacy compatibility wrapper
|
|
413
|
+
export function scanSoulPackageLegacy(files) {
|
|
414
|
+
const result = scanSoulPackage(files);
|
|
415
|
+
return {
|
|
416
|
+
ok: result.ok,
|
|
417
|
+
errors: result.errors.map(e => e.message),
|
|
418
|
+
warnings: result.warnings.map(w => w.message),
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
//# sourceMappingURL=scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/lib/scanner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC;AAyB/C,gDA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