trace-sec 2.1.5 → 2.1.7
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/bin/postinstall.js +121 -0
- package/bin/trace.js +113 -6
- package/package.json +12 -5
- package/requirements.txt +15 -0
- package/src/trace_engine/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/__pycache__/cli.cpython-311.pyc +0 -0
- package/src/trace_engine/__pycache__/doctor.cpython-311.pyc +0 -0
- package/src/trace_engine/__pycache__/interactive.cpython-311.pyc +0 -0
- package/src/trace_engine/__pycache__/verify.cpython-311.pyc +0 -0
- package/src/trace_engine/ai/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/ai/__pycache__/base.cpython-311.pyc +0 -0
- package/src/trace_engine/ai/__pycache__/ollama.cpython-311.pyc +0 -0
- package/src/trace_engine/ai/__pycache__/planner.cpython-311.pyc +0 -0
- package/src/trace_engine/apm/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/apm/__pycache__/builder.cpython-311.pyc +0 -0
- package/src/trace_engine/apm/__pycache__/edges.cpython-311.pyc +0 -0
- package/src/trace_engine/apm/__pycache__/model.cpython-311.pyc +0 -0
- package/src/trace_engine/apm/__pycache__/nodes.cpython-311.pyc +0 -0
- package/src/trace_engine/apm/__pycache__/serialization.cpython-311.pyc +0 -0
- package/src/trace_engine/benchmark/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/benchmark/__pycache__/owasp.cpython-311.pyc +0 -0
- package/src/trace_engine/config/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/config/__pycache__/defaults.cpython-311.pyc +0 -0
- package/src/trace_engine/config/__pycache__/loader.cpython-311.pyc +0 -0
- package/src/trace_engine/config/__pycache__/settings.cpython-311.pyc +0 -0
- package/src/trace_engine/findings/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/findings/__pycache__/correlate.cpython-311.pyc +0 -0
- package/src/trace_engine/findings/__pycache__/model.cpython-311.pyc +0 -0
- package/src/trace_engine/findings/__pycache__/recommendations.cpython-311.pyc +0 -0
- package/src/trace_engine/findings/__pycache__/store.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/base.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/csharp.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/dart.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/django.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/express.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/fastapi.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/flask.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/go.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/nextjs.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/php.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/react_router.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/ruby.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/rust.cpython-311.pyc +0 -0
- package/src/trace_engine/framework/__pycache__/springboot.cpython-311.pyc +0 -0
- package/src/trace_engine/harness/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/harness/__pycache__/benchmark.cpython-311.pyc +0 -0
- package/src/trace_engine/harness/__pycache__/context.cpython-311.pyc +0 -0
- package/src/trace_engine/harness/__pycache__/engine.cpython-311.pyc +0 -0
- package/src/trace_engine/harness/__pycache__/patcher.cpython-311.pyc +0 -0
- package/src/trace_engine/harness/__pycache__/remediators.cpython-311.pyc +0 -0
- package/src/trace_engine/ingest/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/ingest/__pycache__/files.cpython-311.pyc +0 -0
- package/src/trace_engine/ingest/__pycache__/hashing.cpython-311.pyc +0 -0
- package/src/trace_engine/ingest/__pycache__/ignore.cpython-311.pyc +0 -0
- package/src/trace_engine/ingest/__pycache__/repository.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/__pycache__/downloader.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/__pycache__/evaluation.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/__pycache__/orchestrator.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/__pycache__/tracebench.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/laya/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/laya/__pycache__/prompts.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/laya/__pycache__/router.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/laya/__pycache__/schemas.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/laya/__pycache__/telemetry.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/laya/__pycache__/thresholds.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/securebert/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/securebert/__pycache__/cache.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/securebert/__pycache__/classifier.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/dataset.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/dataset_importers.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/laya_trainer.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/lora_system2.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/morefixes_pipeline.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/slicer.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/train_all.cpython-311.pyc +0 -0
- package/src/trace_engine/intelligence/training/__pycache__/trainer.cpython-311.pyc +0 -0
- package/src/trace_engine/mcp/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/mcp/__pycache__/config.cpython-311.pyc +0 -0
- package/src/trace_engine/mcp/__pycache__/server.cpython-311.pyc +0 -0
- package/src/trace_engine/output/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/output/__pycache__/html.cpython-311.pyc +0 -0
- package/src/trace_engine/output/__pycache__/markdown.cpython-311.pyc +0 -0
- package/src/trace_engine/output/__pycache__/sarif.cpython-311.pyc +0 -0
- package/src/trace_engine/output/__pycache__/terminal.cpython-311.pyc +0 -0
- package/src/trace_engine/parsing/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/parsing/__pycache__/calls.cpython-311.pyc +0 -0
- package/src/trace_engine/parsing/__pycache__/language.cpython-311.pyc +0 -0
- package/src/trace_engine/parsing/__pycache__/locations.cpython-311.pyc +0 -0
- package/src/trace_engine/parsing/__pycache__/parser.cpython-311.pyc +0 -0
- package/src/trace_engine/parsing/__pycache__/symbols.cpython-311.pyc +0 -0
- package/src/trace_engine/plugin/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/plugin/__pycache__/evaluator.cpython-311.pyc +0 -0
- package/src/trace_engine/plugin/__pycache__/swebench_adapter.cpython-311.pyc +0 -0
- package/src/trace_engine/plugin/__pycache__/task.cpython-311.pyc +0 -0
- package/src/trace_engine/policy/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/policy/__pycache__/scope.cpython-311.pyc +0 -0
- package/src/trace_engine/runtime/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/runtime/__pycache__/client.cpython-311.pyc +0 -0
- package/src/trace_engine/runtime/__pycache__/observations.cpython-311.pyc +0 -0
- package/src/trace_engine/runtime/__pycache__/target.cpython-311.pyc +0 -0
- package/src/trace_engine/security/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/security/__pycache__/fusion.cpython-311.pyc +0 -0
- package/src/trace_engine/security/__pycache__/hypotheses.cpython-311.pyc +0 -0
- package/src/trace_engine/security/__pycache__/signals.cpython-311.pyc +0 -0
- package/src/trace_engine/security/__pycache__/timing.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/authentication.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/base.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/bfla.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/bola.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/cors.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/deserialization.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/injection.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/mass_assignment.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/path_traversal.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/registry.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/ssrf.cpython-311.pyc +0 -0
- package/src/trace_engine/testpacks/__pycache__/ssti.cpython-311.pyc +0 -0
- package/src/trace_engine/tools/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/trace_engine/tools/__pycache__/adapters.cpython-311.pyc +0 -0
- package/src/trace_engine/tools/__pycache__/base.cpython-311.pyc +0 -0
- package/src/trace_engine/tools/__pycache__/registry.cpython-311.pyc +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TRACE Post-Install Script
|
|
5
|
+
* Automatically provisions Python runtime and core dependencies during `npm install`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
import { existsSync, mkdirSync } from 'fs';
|
|
10
|
+
import { resolve, join, dirname } from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
15
|
+
const projectRoot = resolve(__dirname, '..');
|
|
16
|
+
|
|
17
|
+
const isWin = process.platform === 'win32';
|
|
18
|
+
const userHome = process.env.USERPROFILE || process.env.HOME || '';
|
|
19
|
+
const dedicatedDir = join(userHome, '.trace');
|
|
20
|
+
const dedicatedVenv = join(dedicatedDir, 'venv');
|
|
21
|
+
const venvPython = join(dedicatedVenv, isWin ? 'Scripts' : 'bin', isWin ? 'python.exe' : 'python');
|
|
22
|
+
const venvPip = join(dedicatedVenv, isWin ? 'Scripts' : 'bin', isWin ? 'pip.exe' : 'pip');
|
|
23
|
+
const reqFile = join(projectRoot, 'requirements.txt');
|
|
24
|
+
|
|
25
|
+
function findSystemPython() {
|
|
26
|
+
const candidates = isWin
|
|
27
|
+
? [
|
|
28
|
+
'python',
|
|
29
|
+
'py -3',
|
|
30
|
+
'py',
|
|
31
|
+
'python3',
|
|
32
|
+
join(process.env.LOCALAPPDATA || '', 'Programs', 'Python', 'Python312', 'python.exe'),
|
|
33
|
+
join(process.env.LOCALAPPDATA || '', 'Programs', 'Python', 'Python311', 'python.exe'),
|
|
34
|
+
join(process.env.LOCALAPPDATA || '', 'Programs', 'Python', 'Python310', 'python.exe'),
|
|
35
|
+
join(process.env.PROGRAMFILES || '', 'Python312', 'python.exe'),
|
|
36
|
+
join(process.env.PROGRAMFILES || '', 'Python311', 'python.exe'),
|
|
37
|
+
join(process.env.PROGRAMFILES || '', 'Python310', 'python.exe'),
|
|
38
|
+
]
|
|
39
|
+
: [
|
|
40
|
+
'python3',
|
|
41
|
+
'python',
|
|
42
|
+
'/usr/bin/python3',
|
|
43
|
+
'/usr/local/bin/python3',
|
|
44
|
+
'/opt/homebrew/bin/python3',
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
for (const cmd of candidates) {
|
|
48
|
+
if (!cmd || !cmd.trim()) continue;
|
|
49
|
+
try {
|
|
50
|
+
const execCmd = cmd.includes(' ') && !cmd.startsWith('py ') ? `"${cmd}"` : cmd;
|
|
51
|
+
const ver = execSync(`${execCmd} -c "import sys; print(sys.version_info[0], sys.version_info[1])"`, {
|
|
52
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
53
|
+
encoding: 'utf-8',
|
|
54
|
+
}).trim();
|
|
55
|
+
const parts = ver.split(/\s+/).map(Number);
|
|
56
|
+
if (parts[0] === 3 && parts[1] >= 9) {
|
|
57
|
+
return execCmd;
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
// try next candidate
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
console.log('\n\x1b[32m\x1b[1m[TRACE]\x1b[0m Configuring environment for autonomous security verification...');
|
|
68
|
+
|
|
69
|
+
mkdirSync(dedicatedDir, { recursive: true });
|
|
70
|
+
|
|
71
|
+
const sysPython = findSystemPython();
|
|
72
|
+
if (!sysPython) {
|
|
73
|
+
console.log(' \x1b[38;2;255;158;59m•\x1b[0m Python 3.10+ not detected on PATH yet.');
|
|
74
|
+
console.log(' \x1b[38;2;255;158;59m•\x1b[0m Quick install:');
|
|
75
|
+
if (isWin) {
|
|
76
|
+
console.log(' \x1b[36mwinget install Python.Python.3.11\x1b[0m');
|
|
77
|
+
} else if (process.platform === 'darwin') {
|
|
78
|
+
console.log(' \x1b[36mbrew install python\x1b[0m');
|
|
79
|
+
} else {
|
|
80
|
+
console.log(' \x1b[36msudo apt install -y python3 python3-pip python3-venv\x1b[0m');
|
|
81
|
+
}
|
|
82
|
+
console.log(' Once installed, dependencies will configure automatically on first run.\n');
|
|
83
|
+
process.exit(0);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Create virtualenv if not already created
|
|
87
|
+
if (!existsSync(venvPython)) {
|
|
88
|
+
console.log(` \x1b[38;2;255;158;59m›\x1b[0m Initializing isolated Python environment in ${dedicatedVenv}...`);
|
|
89
|
+
execSync(`${sysPython} -m venv "${dedicatedVenv}"`, { stdio: 'inherit' });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Check if dependencies are already satisfied
|
|
93
|
+
let depsOk = false;
|
|
94
|
+
try {
|
|
95
|
+
execSync(`"${venvPython}" -c "import typer, rich, pydantic, tree_sitter"`, {
|
|
96
|
+
stdio: 'ignore',
|
|
97
|
+
});
|
|
98
|
+
depsOk = true;
|
|
99
|
+
} catch {
|
|
100
|
+
depsOk = false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (!depsOk) {
|
|
104
|
+
console.log(' \x1b[38;2;255;158;59m›\x1b[0m Installing core Python dependencies into dedicated environment...');
|
|
105
|
+
if (existsSync(reqFile)) {
|
|
106
|
+
execSync(`"${venvPython}" -m pip install -r "${reqFile}"`, { stdio: 'inherit' });
|
|
107
|
+
} else {
|
|
108
|
+
execSync(`"${venvPython}" -m pip install typer rich pydantic pydantic-settings networkx httpx orjson tomli-w tree-sitter tree-sitter-language-pack onnxruntime transformers safetensors numpy`, { stdio: 'inherit' });
|
|
109
|
+
}
|
|
110
|
+
console.log(' \x1b[32m✓\x1b[0m Dependencies successfully attached and verified.');
|
|
111
|
+
} else {
|
|
112
|
+
console.log(' \x1b[32m✓\x1b[0m Dedicated runtime dependencies already up to date.');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
console.log('\x1b[32m\x1b[1m✓ TRACE ready to run!\x1b[0m Type \x1b[36mtrace\x1b[0m or \x1b[36mnpx trace-sec\x1b[0m to launch.\n');
|
|
116
|
+
} catch (err) {
|
|
117
|
+
// Never fail npm install completely on postinstall warning
|
|
118
|
+
console.log(` \x1b[38;2;255;158;59m[TRACE]\x1b[0m Background setup notice: ${err.message}`);
|
|
119
|
+
console.log(' Dependencies will be verified when you run \x1b[36mtrace\x1b[0m.\n');
|
|
120
|
+
}
|
|
121
|
+
|
package/bin/trace.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Node.js & NPX launcher for TRACE Python engine.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { spawn } from 'child_process';
|
|
8
|
+
import { spawn, execSync } from 'child_process';
|
|
9
9
|
import { existsSync, mkdirSync, cpSync, writeFileSync } from 'fs';
|
|
10
10
|
import { resolve, join, dirname } from 'path';
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
@@ -84,17 +84,60 @@ if (args[0] === 'install-skill' || args[0] === 'setup-agent' || args[0] === 'ins
|
|
|
84
84
|
// Find virtual environment python or system python
|
|
85
85
|
const isWin = process.platform === 'win32';
|
|
86
86
|
const userHome = process.env.USERPROFILE || process.env.HOME || '';
|
|
87
|
+
const dedicatedVenv = join(userHome, '.trace', 'venv');
|
|
88
|
+
const dedicatedPython = join(dedicatedVenv, isWin ? 'Scripts' : 'bin', isWin ? 'python.exe' : 'python');
|
|
89
|
+
const dedicatedPip = join(dedicatedVenv, isWin ? 'Scripts' : 'bin', isWin ? 'pip.exe' : 'pip');
|
|
90
|
+
const reqFile = join(projectRoot, 'requirements.txt');
|
|
91
|
+
|
|
92
|
+
function findSystemPython() {
|
|
93
|
+
const candidates = isWin
|
|
94
|
+
? [
|
|
95
|
+
'python',
|
|
96
|
+
'py -3',
|
|
97
|
+
'py',
|
|
98
|
+
'python3',
|
|
99
|
+
join(process.env.LOCALAPPDATA || '', 'Programs', 'Python', 'Python312', 'python.exe'),
|
|
100
|
+
join(process.env.LOCALAPPDATA || '', 'Programs', 'Python', 'Python311', 'python.exe'),
|
|
101
|
+
join(process.env.LOCALAPPDATA || '', 'Programs', 'Python', 'Python310', 'python.exe'),
|
|
102
|
+
join(process.env.PROGRAMFILES || '', 'Python312', 'python.exe'),
|
|
103
|
+
join(process.env.PROGRAMFILES || '', 'Python311', 'python.exe'),
|
|
104
|
+
join(process.env.PROGRAMFILES || '', 'Python310', 'python.exe'),
|
|
105
|
+
]
|
|
106
|
+
: [
|
|
107
|
+
'python3',
|
|
108
|
+
'python',
|
|
109
|
+
'/usr/bin/python3',
|
|
110
|
+
'/usr/local/bin/python3',
|
|
111
|
+
'/opt/homebrew/bin/python3',
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
for (const cmd of candidates) {
|
|
115
|
+
if (!cmd || !cmd.trim()) continue;
|
|
116
|
+
try {
|
|
117
|
+
const execCmd = cmd.includes(' ') && !cmd.startsWith('py ') ? `"${cmd}"` : cmd;
|
|
118
|
+
const ver = execSync(`${execCmd} -c "import sys; print(sys.version_info[0], sys.version_info[1])"`, {
|
|
119
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
120
|
+
encoding: 'utf-8',
|
|
121
|
+
}).trim();
|
|
122
|
+
const parts = ver.split(/\s+/).map(Number);
|
|
123
|
+
if (parts[0] === 3 && parts[1] >= 9) {
|
|
124
|
+
return execCmd;
|
|
125
|
+
}
|
|
126
|
+
} catch {
|
|
127
|
+
// try next
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
87
133
|
const candidatePythons = [
|
|
88
134
|
process.env.TRACE_PYTHON,
|
|
135
|
+
dedicatedPython,
|
|
89
136
|
join(process.cwd(), '.venv', isWin ? 'Scripts' : 'bin', isWin ? 'python.exe' : 'python'),
|
|
90
137
|
join(projectRoot, '.venv', isWin ? 'Scripts' : 'bin', isWin ? 'python.exe' : 'python'),
|
|
91
|
-
isWin ? 'D:\\Startup\\TRACE\\.venv\\Scripts\\python.exe' : null,
|
|
92
|
-
join(userHome, '.trace', 'venv', isWin ? 'Scripts' : 'bin', isWin ? 'python.exe' : 'python'),
|
|
93
|
-
join(userHome, '.trace', 'models', 'venv', isWin ? 'Scripts' : 'bin', isWin ? 'python.exe' : 'python'),
|
|
94
|
-
isWin ? 'python' : 'python3',
|
|
95
138
|
];
|
|
96
139
|
|
|
97
|
-
let pythonBin =
|
|
140
|
+
let pythonBin = null;
|
|
98
141
|
for (const cand of candidatePythons) {
|
|
99
142
|
if (cand && existsSync(cand)) {
|
|
100
143
|
pythonBin = cand;
|
|
@@ -102,6 +145,70 @@ for (const cand of candidatePythons) {
|
|
|
102
145
|
}
|
|
103
146
|
}
|
|
104
147
|
|
|
148
|
+
if (!pythonBin) {
|
|
149
|
+
pythonBin = findSystemPython();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!pythonBin) {
|
|
153
|
+
console.error('\n\x1b[31m\x1b[1m[TRACE ERROR]\x1b[0m Python 3.10+ is required to execute TRACE.');
|
|
154
|
+
console.error('Please install Python to proceed:');
|
|
155
|
+
if (isWin) {
|
|
156
|
+
console.error(' \x1b[36mwinget install Python.Python.3.11\x1b[0m (or from https://www.python.org/)\n');
|
|
157
|
+
} else if (process.platform === 'darwin') {
|
|
158
|
+
console.error(' \x1b[36mbrew install python\x1b[0m\n');
|
|
159
|
+
} else {
|
|
160
|
+
console.error(' \x1b[36msudo apt install -y python3 python3-pip python3-venv\x1b[0m\n');
|
|
161
|
+
}
|
|
162
|
+
process.exit(1);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Verify that the resolved Python environment has required TRACE dependencies
|
|
166
|
+
let depsOk = false;
|
|
167
|
+
try {
|
|
168
|
+
execSync(`"${pythonBin}" -c "import typer, rich, pydantic, tree_sitter"`, { stdio: 'ignore' });
|
|
169
|
+
depsOk = true;
|
|
170
|
+
} catch (e) {
|
|
171
|
+
depsOk = false;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (!depsOk) {
|
|
175
|
+
if (existsSync(dedicatedPython)) {
|
|
176
|
+
try {
|
|
177
|
+
execSync(`"${dedicatedPython}" -c "import typer, rich, pydantic, tree_sitter"`, { stdio: 'ignore' });
|
|
178
|
+
pythonBin = dedicatedPython;
|
|
179
|
+
depsOk = true;
|
|
180
|
+
} catch (e) {
|
|
181
|
+
depsOk = false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (!depsOk) {
|
|
186
|
+
console.log('\n\x1b[32m\x1b[1m[TRACE]\x1b[0m Initializing TRACE runtime dependencies in dedicated environment (~/.trace/venv)...');
|
|
187
|
+
try {
|
|
188
|
+
mkdirSync(join(userHome, '.trace'), { recursive: true });
|
|
189
|
+
if (!existsSync(dedicatedPython)) {
|
|
190
|
+
console.log(' \x1b[38;2;255;158;59m›\x1b[0m Creating Python virtual environment in ~/.trace/venv...');
|
|
191
|
+
const sysPy = findSystemPython();
|
|
192
|
+
if (!sysPy) {
|
|
193
|
+
throw new Error('System Python 3.10+ not found. Please install Python from https://www.python.org/');
|
|
194
|
+
}
|
|
195
|
+
execSync(`${sysPy} -m venv "${dedicatedVenv}"`, { stdio: 'inherit' });
|
|
196
|
+
}
|
|
197
|
+
console.log(' \x1b[38;2;255;158;59m›\x1b[0m Installing core dependencies via pip...');
|
|
198
|
+
if (existsSync(reqFile)) {
|
|
199
|
+
execSync(`"${dedicatedPython}" -m pip install -r "${reqFile}"`, { stdio: 'inherit' });
|
|
200
|
+
} else {
|
|
201
|
+
execSync(`"${dedicatedPython}" -m pip install typer rich pydantic pydantic-settings networkx httpx orjson tomli-w tree-sitter tree-sitter-language-pack onnxruntime transformers safetensors numpy`, { stdio: 'inherit' });
|
|
202
|
+
}
|
|
203
|
+
pythonBin = dedicatedPython;
|
|
204
|
+
console.log('\x1b[32m✓ Runtime dependencies provisioned successfully.\x1b[0m\n');
|
|
205
|
+
} catch (e) {
|
|
206
|
+
console.warn(`[TRACE] Automatic environment setup warning: ${e.message}`);
|
|
207
|
+
console.warn(`If command fails, install directly via: pip install git+https://github.com/VK-Amogh/TRACE.git\n`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
105
212
|
const cliArgs = ['-m', 'trace_engine.cli', ...args];
|
|
106
213
|
|
|
107
214
|
const proc = spawn(pythonBin, cliArgs, {
|
package/package.json
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trace-sec",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "Threat Reconnaissance & Attack-path Correlation Engine — Security Verification Layer for Coding Agents with Fine-Tuned SecureBERT 2.0 & Laya AI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/trace.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"postinstall": "node bin/postinstall.js"
|
|
9
|
+
},
|
|
7
10
|
"bin": {
|
|
8
|
-
"trace": "
|
|
9
|
-
"trace-sec": "
|
|
10
|
-
"trace-security": "
|
|
11
|
+
"trace": "bin/trace.js",
|
|
12
|
+
"trace-sec": "bin/trace.js",
|
|
13
|
+
"trace-security": "bin/trace.js"
|
|
11
14
|
},
|
|
12
15
|
"files": [
|
|
13
16
|
"bin",
|
|
14
17
|
"src",
|
|
15
18
|
"README.md",
|
|
16
|
-
"pyproject.toml"
|
|
19
|
+
"pyproject.toml",
|
|
20
|
+
"requirements.txt",
|
|
21
|
+
"!**/__pycache__",
|
|
22
|
+
"!**/*.pyc",
|
|
23
|
+
"!**/*.pyo"
|
|
17
24
|
],
|
|
18
25
|
"repository": {
|
|
19
26
|
"type": "git",
|
package/requirements.txt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
typer>=0.12.0
|
|
2
|
+
rich>=13.7.0
|
|
3
|
+
pydantic>=2.7.0
|
|
4
|
+
pydantic-settings>=2.2.0
|
|
5
|
+
networkx>=3.2.0
|
|
6
|
+
httpx>=0.27.0
|
|
7
|
+
orjson>=3.9.0
|
|
8
|
+
tomli-w>=1.0.0
|
|
9
|
+
tree-sitter>=0.21.0
|
|
10
|
+
tree-sitter-language-pack>=0.2.0
|
|
11
|
+
transformers>=4.40.0
|
|
12
|
+
safetensors>=0.4.0
|
|
13
|
+
onnxruntime>=1.17.0
|
|
14
|
+
numpy>=1.24.0
|
|
15
|
+
torch>=2.0.0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/trace_engine/intelligence/training/__pycache__/dataset_importers.cpython-311.pyc
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/trace_engine/intelligence/training/__pycache__/morefixes_pipeline.cpython-311.pyc
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|