Skip to content

Chrome DevTools for coding agents

fix: honor explicit --allowUnrestrictedPaths=false in CLI mode (#3040)

落尘61fc362b7ed5
diff --git a/src/config/ConfigParser.ts b/src/config/ConfigParser.ts
index 75ef128f..9ddfc5d3 100644
--- a/src/config/ConfigParser.ts
+++ b/src/config/ConfigParser.ts
@@ -187,7 +187,10 @@ export class ConfigParser {
}
if (isViaCli) {
- if (resolvedArgs.filesystemRoot === DEFAULT_FILESYSTEM_ROOT) {
+ if (
+ resolvedArgs.filesystemRoot === DEFAULT_FILESYSTEM_ROOT &&
+ explicitArgs.allowUnrestrictedPaths !== false
+ ) {
resolvedArgs.allowUnrestrictedPaths = true;
resolvedArgs.filesystemRoot = undefined;
}
diff --git a/tests/config/mcp-options.test.ts b/tests/config/mcp-options.test.ts
index 92a1bb7c..6f456ea2 100644
--- a/tests/config/mcp-options.test.ts
+++ b/tests/config/mcp-options.test.ts
@@ -170,6 +170,15 @@ describe('mcp-options steps', () => {
assert.strictEqual(args.filesystemRoot, undefined);
});
+ it('keeps the default filesystem root for viaCli with explicit allowUnrestrictedPaths=false', () => {
+ const args = new ConfigParser('0.0.0', [], {}).applyDefaults({
+ viaCli: true,
+ allowUnrestrictedPaths: false,
+ });
+ assert.strictEqual(args.allowUnrestrictedPaths, false);
+ assert.deepStrictEqual(args.filesystemRoot, DEFAULT_FILESYSTEM_ROOT);
+ });
+
it('does not enable isolated or extensions for viaCli with browserUrl', () => {
const args = new ConfigParser('0.0.0', [], {}).applyDefaults({
viaCli: true,