@securecode-ai/mcp 0.5.4 → 0.5.6
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/api/types.d.ts +7 -0
- package/dist/approval/auditLog.d.ts +1 -1
- package/dist/approval/auditLog.js +11 -3
- package/dist/approval/auditLog.js.map +1 -1
- package/dist/approval/broker.d.ts +7 -2
- package/dist/approval/broker.js +239 -110
- package/dist/approval/broker.js.map +1 -1
- package/dist/approval/policy.d.ts +10 -0
- package/dist/approval/policy.js +104 -0
- package/dist/approval/policy.js.map +1 -0
- package/dist/approval/types.d.ts +11 -2
- package/dist/approval/types.js +10 -1
- package/dist/approval/types.js.map +1 -1
- package/dist/attack/agentScanExecutor.d.ts +35 -1
- package/dist/attack/agentScanExecutor.js +405 -76
- package/dist/attack/agentScanExecutor.js.map +1 -1
- package/dist/attack/agentScanLoop.d.ts +20 -0
- package/dist/attack/agentScanLoop.js +1264 -60
- package/dist/attack/agentScanLoop.js.map +1 -1
- package/dist/attack/agentScanProtocol.d.ts +382 -6
- package/dist/attack/agentScanProtocol.js +110 -4
- package/dist/attack/agentScanProtocol.js.map +1 -1
- package/dist/attack/agentTrace.d.ts +73 -0
- package/dist/attack/agentTrace.js +228 -0
- package/dist/attack/agentTrace.js.map +1 -0
- package/dist/attack/architectureScoutExecutor.d.ts +18 -0
- package/dist/attack/architectureScoutExecutor.js +211 -0
- package/dist/attack/architectureScoutExecutor.js.map +1 -0
- package/dist/attack/architectureScoutLoop.d.ts +36 -0
- package/dist/attack/architectureScoutLoop.js +403 -0
- package/dist/attack/architectureScoutLoop.js.map +1 -0
- package/dist/attack/architectureScoutProtocol.d.ts +209 -0
- package/dist/attack/architectureScoutProtocol.js +47 -0
- package/dist/attack/architectureScoutProtocol.js.map +1 -0
- package/dist/attack/candidateStore.d.ts +95 -0
- package/dist/attack/candidateStore.js +231 -0
- package/dist/attack/candidateStore.js.map +1 -0
- package/dist/attack/evidenceLedger.d.ts +67 -0
- package/dist/attack/evidenceLedger.js +192 -0
- package/dist/attack/evidenceLedger.js.map +1 -0
- package/dist/attack/finishGate.d.ts +62 -0
- package/dist/attack/finishGate.js +209 -0
- package/dist/attack/finishGate.js.map +1 -0
- package/dist/attack/fixCodeMerge.d.ts +27 -0
- package/dist/attack/fixCodeMerge.js +42 -0
- package/dist/attack/fixCodeMerge.js.map +1 -0
- package/dist/attack/fixVerifyLoop.d.ts +55 -0
- package/dist/attack/fixVerifyLoop.js +187 -0
- package/dist/attack/fixVerifyLoop.js.map +1 -0
- package/dist/attack/investigationProfiles.d.ts +36 -0
- package/dist/attack/investigationProfiles.js +144 -0
- package/dist/attack/investigationProfiles.js.map +1 -0
- package/dist/attack/investigationState.d.ts +227 -0
- package/dist/attack/investigationState.js +666 -0
- package/dist/attack/investigationState.js.map +1 -0
- package/dist/attack/mutationOperators.d.ts +22 -0
- package/dist/attack/mutationOperators.js +170 -0
- package/dist/attack/mutationOperators.js.map +1 -0
- package/dist/attack/mutationTest.d.ts +33 -0
- package/dist/attack/mutationTest.js +110 -0
- package/dist/attack/mutationTest.js.map +1 -0
- package/dist/attack/proofGate.d.ts +20 -0
- package/dist/attack/proofGate.js +104 -0
- package/dist/attack/proofGate.js.map +1 -0
- package/dist/attack/proofTypes.d.ts +57 -0
- package/dist/attack/proofTypes.js +32 -0
- package/dist/attack/proofTypes.js.map +1 -0
- package/dist/attack/protocolValidator.d.ts +50 -0
- package/dist/attack/protocolValidator.js +427 -0
- package/dist/attack/protocolValidator.js.map +1 -0
- package/dist/attack/qualityMetrics.d.ts +133 -0
- package/dist/attack/qualityMetrics.js +226 -0
- package/dist/attack/qualityMetrics.js.map +1 -0
- package/dist/attack/scanScheduler.d.ts +52 -0
- package/dist/attack/scanScheduler.js +265 -0
- package/dist/attack/scanScheduler.js.map +1 -0
- package/dist/attack/scanState.d.ts +58 -0
- package/dist/attack/scanState.js +102 -0
- package/dist/attack/scanState.js.map +1 -0
- package/dist/attack/searchIntent.d.ts +16 -0
- package/dist/attack/searchIntent.js +57 -0
- package/dist/attack/searchIntent.js.map +1 -0
- package/dist/attack/verifyLoop.d.ts +43 -0
- package/dist/attack/verifyLoop.js +329 -15
- package/dist/attack/verifyLoop.js.map +1 -1
- package/dist/attack/workItem.d.ts +57 -0
- package/dist/attack/workItem.js +225 -0
- package/dist/attack/workItem.js.map +1 -0
- package/dist/audit/findingReviewQueue.d.ts +109 -0
- package/dist/audit/findingReviewQueue.js +335 -0
- package/dist/audit/findingReviewQueue.js.map +1 -0
- package/dist/audit/scanAuditLog.d.ts +160 -0
- package/dist/audit/scanAuditLog.js +404 -0
- package/dist/audit/scanAuditLog.js.map +1 -0
- package/dist/dependency/dependencyChecker.js +35 -9
- package/dist/dependency/dependencyChecker.js.map +1 -1
- package/dist/dependency/exploitPriority.d.ts +33 -0
- package/dist/dependency/exploitPriority.js +78 -0
- package/dist/dependency/exploitPriority.js.map +1 -0
- package/dist/dependency/finding.d.ts +16 -0
- package/dist/dependency/osvClient.js +2 -0
- package/dist/dependency/osvClient.js.map +1 -1
- package/dist/dependency/types.d.ts +12 -1
- package/dist/mcp/server.js +13 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts +1 -0
- package/dist/mcp/tools.js +127 -6
- package/dist/mcp/tools.js.map +1 -1
- package/dist/project-map/agentMemory.d.ts +83 -1
- package/dist/project-map/agentMemory.js +197 -7
- package/dist/project-map/agentMemory.js.map +1 -1
- package/dist/project-map/architectureContext.d.ts +202 -0
- package/dist/project-map/architectureContext.js +421 -0
- package/dist/project-map/architectureContext.js.map +1 -0
- package/dist/project-map/blastRadius.d.ts +54 -0
- package/dist/project-map/blastRadius.js +196 -0
- package/dist/project-map/blastRadius.js.map +1 -0
- package/dist/project-map/callGraphExtractor.d.ts +13 -0
- package/dist/project-map/callGraphExtractor.js +222 -0
- package/dist/project-map/callGraphExtractor.js.map +1 -0
- package/dist/project-map/capabilityRegistry.d.ts +46 -0
- package/dist/project-map/capabilityRegistry.js +91 -0
- package/dist/project-map/capabilityRegistry.js.map +1 -0
- package/dist/project-map/findTests.d.ts +29 -0
- package/dist/project-map/findTests.js +236 -0
- package/dist/project-map/findTests.js.map +1 -0
- package/dist/project-map/handlerInventory.d.ts +112 -0
- package/dist/project-map/handlerInventory.js +184 -0
- package/dist/project-map/handlerInventory.js.map +1 -0
- package/dist/project-map/implementationResolver.d.ts +43 -0
- package/dist/project-map/implementationResolver.js +217 -0
- package/dist/project-map/implementationResolver.js.map +1 -0
- package/dist/project-map/mapContext.d.ts +6 -1
- package/dist/project-map/mapContext.js +1 -0
- package/dist/project-map/mapContext.js.map +1 -1
- package/dist/project-map/scanCache.d.ts +57 -3
- package/dist/project-map/scanCache.js +61 -2
- package/dist/project-map/scanCache.js.map +1 -1
- package/dist/project-map/symbolIndex.d.ts +39 -0
- package/dist/project-map/symbolIndex.js +385 -0
- package/dist/project-map/symbolIndex.js.map +1 -0
- package/dist/tooling/agentEvalScoring.d.ts +77 -0
- package/dist/tooling/agentEvalScoring.js +140 -0
- package/dist/tooling/agentEvalScoring.js.map +1 -0
- package/dist/tooling/agentRegression.d.ts +53 -0
- package/dist/tooling/agentRegression.js +99 -0
- package/dist/tooling/agentRegression.js.map +1 -0
- package/dist/tools/agentScan.d.ts +69 -0
- package/dist/tools/agentScan.js +702 -43
- package/dist/tools/agentScan.js.map +1 -1
- package/dist/tools/findingReviewTools.d.ts +22 -0
- package/dist/tools/findingReviewTools.js +121 -0
- package/dist/tools/findingReviewTools.js.map +1 -0
- package/dist/tools/fix.js +1 -1
- package/dist/tools/fix.js.map +1 -1
- package/dist/tools/map.js +191 -1
- package/dist/tools/map.js.map +1 -1
- package/dist/tools/runTests.d.ts +2 -0
- package/dist/tools/runTests.js +29 -0
- package/dist/tools/runTests.js.map +1 -0
- package/dist/utils/effectMock.d.ts +1 -0
- package/dist/utils/effectMock.js +162 -0
- package/dist/utils/effectMock.js.map +1 -0
- package/dist/utils/gitContext.d.ts +26 -0
- package/dist/utils/gitContext.js +317 -0
- package/dist/utils/gitContext.js.map +1 -0
- package/dist/utils/localTestRunner.d.ts +57 -2
- package/dist/utils/localTestRunner.js +122 -101
- package/dist/utils/localTestRunner.js.map +1 -1
- package/dist/utils/runtimeDetect.d.ts +12 -2
- package/dist/utils/runtimeDetect.js +247 -10
- package/dist/utils/runtimeDetect.js.map +1 -1
- package/dist/utils/securityConfig.d.ts +17 -0
- package/dist/utils/securityConfig.js +192 -0
- package/dist/utils/securityConfig.js.map +1 -0
- package/dist/utils/testCommandPolicy.d.ts +36 -0
- package/dist/utils/testCommandPolicy.js +252 -0
- package/dist/utils/testCommandPolicy.js.map +1 -0
- package/dist/utils/testRunner.d.ts +56 -0
- package/dist/utils/testRunner.js +246 -0
- package/dist/utils/testRunner.js.map +1 -0
- package/dist/utils/testSafety.d.ts +40 -2
- package/dist/utils/testSafety.js +205 -26
- package/dist/utils/testSafety.js.map +1 -1
- package/dist/utils/verificationSandbox.d.ts +113 -0
- package/dist/utils/verificationSandbox.js +656 -0
- package/dist/utils/verificationSandbox.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verification sandbox — the real security boundary for LLM-generated tests.
|
|
3
|
+
*
|
|
4
|
+
* Phase 2 of the agent scan pipeline takes an LLM-generated test script and
|
|
5
|
+
* executes it on the user's machine. The previous implementation ran the
|
|
6
|
+
* script via `execFileSync` with the full `process.env` spread and only a
|
|
7
|
+
* decorative blocklist (`checkTestSafety`) in front. Prompt-injected code
|
|
8
|
+
* in the scanned source could ride into the verify-generate prompt and
|
|
9
|
+
* produce a test script that exfiltrated secrets, hit the network, or
|
|
10
|
+
* spawned processes — `checkTestSafety` missed `fetch`, `http`, `https`,
|
|
11
|
+
* `fs`, `dns`, `eval`, `new Function`, dynamic imports, and `process.env`
|
|
12
|
+
* access.
|
|
13
|
+
*
|
|
14
|
+
* This module replaces that with a real isolation boundary. Pluggable
|
|
15
|
+
* backends provide kernel-enforced isolation:
|
|
16
|
+
*
|
|
17
|
+
* - DockerSandbox: `docker run --network=none --cpus=1
|
|
18
|
+
* --memory=256m --pids-limit=64 --user 1000:1000 -v <workspace>:/workspace:ro`
|
|
19
|
+
* — network disabled at the kernel level, workspace read-only, temp
|
|
20
|
+
* dir as tmpfs, no host env, non-root user. Works for any Node/Python
|
|
21
|
+
* test script unchanged.
|
|
22
|
+
* - DenoSandbox: `deno run --allow-read=<workspace> --allow-write=<tmp>
|
|
23
|
+
* --allow-env=NODE_ENV --no-prompt --no-remote` — real permission
|
|
24
|
+
* model, no network, no arbitrary fs, no arbitrary env. Only works
|
|
25
|
+
* for test scripts that don't use `require()` (Deno is ESM-only by
|
|
26
|
+
* default); the verify-generate prompt must be told to emit
|
|
27
|
+
* Deno-compatible code when Deno is the backend.
|
|
28
|
+
*
|
|
29
|
+
* If neither backend is available, `detectSandbox()` returns null and the
|
|
30
|
+
* caller MUST return INCONCLUSIVE. Never fall back to unrestricted
|
|
31
|
+
* `execFileSync` — that is the bug this module exists to fix.
|
|
32
|
+
*
|
|
33
|
+
* `checkTestSafety()` remains as defense-in-depth (it can reject scripts
|
|
34
|
+
* before we pay for a container start), but it is NOT the security
|
|
35
|
+
* boundary. The sandbox is.
|
|
36
|
+
*/
|
|
37
|
+
export interface SandboxExecuteOptions {
|
|
38
|
+
/** Execution mode: 'script' (default) runs a script via runner; 'command' runs a validated executable+args. */
|
|
39
|
+
mode?: 'script' | 'command';
|
|
40
|
+
/** Test script source code (required for mode='script'). */
|
|
41
|
+
script?: string;
|
|
42
|
+
/** Runner: 'node' | 'tsx' | 'bun' | 'python' | 'python3' | 'deno' | ... (required for mode='script'). */
|
|
43
|
+
runner?: string;
|
|
44
|
+
/** Validated executable (required for mode='command'). Passed as argv[0] — never via shell. */
|
|
45
|
+
executable?: string;
|
|
46
|
+
/** Validated args array (required for mode='command'). Each arg passed as a separate argv element. */
|
|
47
|
+
args?: string[];
|
|
48
|
+
/** Workspace root — mounted read-only into the sandbox. */
|
|
49
|
+
workspaceRoot: string;
|
|
50
|
+
/** Optional setup script run before the test (same sandbox). */
|
|
51
|
+
setupScript?: string | null;
|
|
52
|
+
/** Hard wall-clock timeout in ms. The sandbox kills the process at this boundary. */
|
|
53
|
+
timeoutMs: number;
|
|
54
|
+
/** AbortSignal — if aborted, the sandbox must kill the process and return. */
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
}
|
|
57
|
+
export interface SandboxExecuteResult {
|
|
58
|
+
verdict: 'pass' | 'fail' | 'error' | 'timeout' | 'blocked' | 'sandbox-unavailable' | 'cancelled';
|
|
59
|
+
output: string;
|
|
60
|
+
exitCode: number;
|
|
61
|
+
/** Identifier of the backend that ran the test (for logging). */
|
|
62
|
+
backend: string;
|
|
63
|
+
}
|
|
64
|
+
export interface SandboxBackend {
|
|
65
|
+
readonly name: string;
|
|
66
|
+
readonly available: boolean;
|
|
67
|
+
execute(opts: SandboxExecuteOptions): Promise<SandboxExecuteResult>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Command-mode verdict: no PASS:/FAIL: markers. Exit code 0 = pass, nonzero = fail.
|
|
71
|
+
* This is the standard semantics for `npm test`, `pytest`, etc.
|
|
72
|
+
*/
|
|
73
|
+
export declare function parseVerdictCommandMode(exitCode: number, timedOut: boolean): SandboxExecuteResult['verdict'];
|
|
74
|
+
/**
|
|
75
|
+
* Pick the Docker image for a command-mode executable. Returns null if no
|
|
76
|
+
* suitable image is configured — the caller returns sandbox-unavailable.
|
|
77
|
+
*/
|
|
78
|
+
export declare function pickImageForCommand(executable: string): {
|
|
79
|
+
image: string | null;
|
|
80
|
+
reason?: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Pick the Docker image for a script-mode runner. Returns null if no suitable
|
|
84
|
+
* image is configured — the caller returns sandbox-unavailable so the user
|
|
85
|
+
* gets a clear "install X / set ENV to enable" message rather than a crash.
|
|
86
|
+
*/
|
|
87
|
+
export declare function pickImageForRunner(runner: string): {
|
|
88
|
+
image: string | null;
|
|
89
|
+
reason?: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Build the in-container command string for a runner + script path.
|
|
93
|
+
* The path is generated by us (unique suffix), so shell quoting is not
|
|
94
|
+
* required for safety; we still quote defensively in case the workspace
|
|
95
|
+
* path contains spaces.
|
|
96
|
+
*/
|
|
97
|
+
export declare function runnerInvocation(runner: string, scriptPath: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* Detect the best available sandbox backend. Docker is preferred (runs any
|
|
100
|
+
* Node/Python test unchanged); Deno is a fallback for TS/JS tests only.
|
|
101
|
+
* Returns null if neither is available — the caller MUST return INCONCLUSIVE.
|
|
102
|
+
*/
|
|
103
|
+
export declare function detectSandbox(): SandboxBackend | null;
|
|
104
|
+
/** Reset the cached backend selection. Used by tests. */
|
|
105
|
+
export declare function _resetSandboxCacheForTests(): void;
|
|
106
|
+
/** Force a specific backend (for tests). Pass null to simulate "no sandbox". */
|
|
107
|
+
export declare function _setSandboxForTests(backend: SandboxBackend | null): void;
|
|
108
|
+
export declare class __UnsafeHostSandboxForTests implements SandboxBackend {
|
|
109
|
+
readonly name = "unsafe-host-tests-only";
|
|
110
|
+
constructor();
|
|
111
|
+
get available(): boolean;
|
|
112
|
+
execute(opts: SandboxExecuteOptions): Promise<SandboxExecuteResult>;
|
|
113
|
+
}
|