Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: strip permission-bypass flags from the ordinary CLI review fallback (#9409)

[._.]/ Adam Eivy26c74424faa2
diff --git a/server/lib/cliProviderRun.js b/server/lib/cliProviderRun.js
index 6a93e47824..f66ce6e056 100644
--- a/server/lib/cliProviderRun.js
+++ b/server/lib/cliProviderRun.js
@@ -23,7 +23,7 @@ import { killProcessTree, guardChildStdin } from './bufferedSpawn.js';
import { buildCliChildEnv } from './cliChildEnv.js';
import { modelPinIsOffered } from './localProviderRuntime.js';
import { filterCallerModeEligible } from './callerModePolicy.js';
-import { buildCodeReviewSpawnConfig, buildVendorSpawnConfig, supportsPublicReviewProvider } from './providerVendors.js';
+import { buildCodeReviewSpawnConfig, buildVendorSpawnConfig, supportsPublicReviewProvider, toolFreeOneShotArgs } from './providerVendors.js';
import { isPublicReviewNoToolProfile } from './agentExecutionProfiles.js';
import { resolveCliModel, stripProviderPinArgs } from './providerModels.js';
import { resolveCliSpawn, needsProcessGroup, trackDetachedGroup } from './credentialBootstrap.js';
@@ -131,7 +131,11 @@ export function runCliProviderPrompt(args = {}) {
const restrictedConfig = safetyProfile ? (codeReview ? buildCodeReviewSpawnConfig : buildVendorSpawnConfig)(effectiveProvider, {
safetyProfile, effectiveModel: resolveCliModel(effectiveProvider.defaultModel), effort: effectiveProvider.effort,
}) : null;
- const builtArgs = restrictedConfig?.args || [...buildCliArgs(effectiveProvider), ...(Array.isArray(extraArgs) ? extraArgs : [])];
+ const ordinaryArgs = [...buildCliArgs(effectiveProvider), ...(Array.isArray(extraArgs) ? extraArgs : [])];
+ // A review-only run on a vendor with no enforced recipe falls back to its
+ // ordinary argv; strip every blanket permission grant from it (#9409) while
+ // keeping the model/effort pins. Authoring runs (no codeReview) are untouched.
+ const builtArgs = restrictedConfig?.args || (safetyProfile && codeReview ? toolFreeOneShotArgs(effectiveProvider, ordinaryArgs).args : ordinaryArgs);
const streamFormat = restrictedConfig?.streamFormat || (builtArgs.some((arg, index) => arg === '--output-format=stream-json' || (arg === '--output-format' && builtArgs[index + 1] === 'stream-json')) ? 'stream-json' : null);
// Deliver the prompt per provider convention: antigravity gets it as the
// --print VALUE (no stdin); grok's `--prompt-file /dev/stdin` is fed via stdin
diff --git a/server/lib/cliProviderRun.test.js b/server/lib/cliProviderRun.test.js
index 60a2bbb2c9..7610146506 100644
--- a/server/lib/cliProviderRun.test.js
+++ b/server/lib/cliProviderRun.test.js
@@ -131,6 +131,24 @@ describe('runCliProviderPrompt', () => {
}
});
+ // #9409: a vendor with no enforced reviewer recipe (agy) falls back to its ordinary argv.
+ it.skipIf(process.platform === 'win32')('strips blanket permission grants from the ordinary review fallback but keeps pins', async () => {
+ const { mkdtemp, writeFile, rm } = await import('node:fs/promises');
+ const { tmpdir } = await import('node:os');
+ const { join } = await import('node:path');
+ const dir = await mkdtemp(join(tmpdir(), 'review-cli-fallback-'));
+ const command = join(dir, 'agy');
+ await writeFile(command, '#!/usr/bin/env node\nprocess.stdin.resume(); process.stdin.on("end", () => process.stdout.write(JSON.stringify({ args: process.argv.slice(2) })));\nif (!process.stdin.readable) process.stdout.write(JSON.stringify({ args: process.argv.slice(2) }));', { mode: 0o755 });
+ const result = await runCliProviderPrompt({
+ provider: { ...cli('example-agy'), command, args: ['--dangerously-skip-permissions', '--yolo'] },
+ model: 'pinned-model', prompt: 'untrusted diff', cwd: dir, safetyProfile: 'public-review-gate', codeReview: true,
+ }).finally(() => rm(dir, { recursive: true, force: true }));
+ const argv = result.text || '';
+ expect(result.error).toBeUndefined();
+ expect(argv).not.toMatch(/skip-permissions|yolo/);
+ expect(argv).toContain('pinned-model');
+ });
+
it.skipIf(process.platform === 'win32')('enforces the shared no-tool argv and environment on an actual child', async () => {
const { mkdtemp, writeFile, rm } = await import('node:fs/promises');
const { tmpdir } = await import('node:os');