super-opencode 1.1.1 → 1.1.2
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/cli.js +6 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -21,8 +21,11 @@ const FALLBACK_FILENAME = "mcp_settings.json";
|
|
|
21
21
|
function resolveSafePath(baseDir, targetPath) {
|
|
22
22
|
const resolvedBase = path.resolve(baseDir);
|
|
23
23
|
const resolvedTarget = path.resolve(targetPath);
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// Normalize paths for cross-platform comparison
|
|
25
|
+
const normalizedBase = path.normalize(resolvedBase).toLowerCase();
|
|
26
|
+
const normalizedTarget = path.normalize(resolvedTarget).toLowerCase();
|
|
27
|
+
if (!normalizedTarget.startsWith(normalizedBase + path.sep) &&
|
|
28
|
+
normalizedTarget !== normalizedBase) {
|
|
26
29
|
throw new Error(`Path traversal detected: ${resolvedTarget} is outside ${resolvedBase}`);
|
|
27
30
|
}
|
|
28
31
|
return resolvedTarget;
|
|
@@ -275,7 +278,7 @@ async function collectMcpServerConfigs(selectedServers, targetDir) {
|
|
|
275
278
|
async function writeMcpConfiguration(mcpServers, scope, targetDir) {
|
|
276
279
|
const configPath = scope === "global"
|
|
277
280
|
? path.join(os.homedir(), ".config", "opencode", CONFIG_FILENAME)
|
|
278
|
-
: path.join(
|
|
281
|
+
: path.join(targetDir, CONFIG_FILENAME);
|
|
279
282
|
let finalSettings = {};
|
|
280
283
|
let writeTarget = configPath;
|
|
281
284
|
if (scope === "global") {
|