@securityreviewai/securityreview-kit 0.1.47 → 0.1.48
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/package.json
CHANGED
|
@@ -2,19 +2,6 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { readJson, writeJson } from '../../utils/fs-helpers.js';
|
|
3
3
|
import { MCP_SERVER_NAME, MCP_SERVER_PACKAGE } from '../../utils/constants.js';
|
|
4
4
|
|
|
5
|
-
function getSandboxAllowedDomains(apiUrl) {
|
|
6
|
-
const domains = ['registry.npmjs.org'];
|
|
7
|
-
try {
|
|
8
|
-
const hostname = new URL(apiUrl).hostname;
|
|
9
|
-
if (hostname) {
|
|
10
|
-
domains.push(hostname);
|
|
11
|
-
}
|
|
12
|
-
} catch {
|
|
13
|
-
// Keep the documented sandbox shape even if the URL is supplied later through another workflow.
|
|
14
|
-
}
|
|
15
|
-
return [...new Set(domains)];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
5
|
/**
|
|
19
6
|
* Generate VS Code Copilot MCP config at .vscode/mcp.json
|
|
20
7
|
* Uses the VS Code input variable pattern for secure credential prompting.
|
|
@@ -35,12 +22,6 @@ export function generate(cwd, envVars) {
|
|
|
35
22
|
SECURITY_REVIEW_API_URL: envVars.apiUrl,
|
|
36
23
|
SECURITY_REVIEW_API_TOKEN: envVars.apiToken,
|
|
37
24
|
},
|
|
38
|
-
sandboxEnabled: true,
|
|
39
|
-
sandbox: {
|
|
40
|
-
network: {
|
|
41
|
-
allowedDomains: getSandboxAllowedDomains(envVars.apiUrl),
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
25
|
};
|
|
45
26
|
|
|
46
27
|
writeJson(filePath, existing);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { mkdtempSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { test } from 'node:test';
|
|
5
|
-
import assert from 'node:assert/strict';
|
|
6
|
-
import { generate } from './vscode.js';
|
|
7
|
-
|
|
8
|
-
test('VS Code MCP generator enables sandbox auto-approval for the SRAI server', () => {
|
|
9
|
-
const cwd = mkdtempSync(join(tmpdir(), 'securityreview-kit-vscode-mcp-'));
|
|
10
|
-
|
|
11
|
-
generate(cwd, {
|
|
12
|
-
apiUrl: 'https://api.example.test/v1',
|
|
13
|
-
apiToken: 'secret-token',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const config = JSON.parse(readFileSync(join(cwd, '.vscode', 'mcp.json'), 'utf8'));
|
|
17
|
-
const server = config.servers['security-review-mcp'];
|
|
18
|
-
assert.equal(server.type, 'stdio');
|
|
19
|
-
assert.equal(server.sandboxEnabled, true);
|
|
20
|
-
assert.deepEqual(server.sandbox.network.allowedDomains, ['registry.npmjs.org', 'api.example.test']);
|
|
21
|
-
});
|