Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(provider-sharing): bind credential exemptions to search and Git sources

MagicLizi0837b021cd83
diff --git a/apps/desktop/src/main/remote-agent/credentials.ts b/apps/desktop/src/main/remote-agent/credentials.ts
index bfa8fe819d..8e9bd00303 100644
--- a/apps/desktop/src/main/remote-agent/credentials.ts
+++ b/apps/desktop/src/main/remote-agent/credentials.ts
@@ -134,6 +134,7 @@ export function isShareCredentialCommand(
return commandSpellsOutSecret(command)
|| shellCommandReadsCredentials(opts.resolveFilePath ? command : shareCredentialText(command), workspaceRoots, {
...credentialCommandOptions(opts),
+ gitContentRead: () => false,
gitConfigRead: () => false,
});
}
diff --git a/apps/desktop/src/main/remote-agent/executor/__tests__/executor.test.ts b/apps/desktop/src/main/remote-agent/executor/__tests__/executor.test.ts
index 115a665e0b..7eff8a3f3f 100644
--- a/apps/desktop/src/main/remote-agent/executor/__tests__/executor.test.ts
+++ b/apps/desktop/src/main/remote-agent/executor/__tests__/executor.test.ts
@@ -1,3 +1,4 @@
+import { execFileSync } from 'node:child_process';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
@@ -597,6 +598,33 @@ describe('shared provider credentials', () => {
return { executor, gate, workspace };
}
+ it.runIf(posix)('keeps source-filter searches from following a link into credentials without consent', async () => {
+ fs.writeFileSync(path.join(project, '.env'), 'PRIVATE_FIXTURE=followed-link');
+ fs.symlinkSync('.env', path.join(project, 'safe.ts'));
+ const output = execFileSync(RG, ['--follow', '-g', '*.ts', 'PRIVATE_FIXTURE', '.'], { cwd: project, encoding: 'utf8' });
+ expect(output).toContain('PRIVATE_FIXTURE=followed-link');
+ const asked = vi.fn(async () => false);
+ const { gate, executor } = sharedExecutor('full', asked);
+ try {
+ const safe: ExecutorAction = { kind: 'exec', command: "rg -g '*.ts' PRIVATE_FIXTURE .", cwd: project };
+ expect(gate.authorize(safe).ok).toBe(true);
+ for (const command of [
+ "rg --follow -g '*.ts' PRIVATE_FIXTURE .",
+ "rg -nL -g '*.ts' PRIVATE_FIXTURE .",
+ "grep -R --include='*.ts' PRIVATE_FIXTURE .",
+ "grep --dereference-r --include='*.ts' PRIVATE_FIXTURE .",
+ ]) {
+ const action: ExecutorAction = { kind: 'exec', command, cwd: project };
+ expect(gate.authorize(action).ok, command).toBe(false);
+ expect(await executor.confirm(action), command).toBe(false);
+ expect(gate.authorize(action).ok, command).toBe(false);
+ }
+ expect(asked).toHaveBeenCalledTimes(4);
+ } finally {
+ await executor.close();
+ }
+ });
+
it('holds credential reads, writes and commands even with full access, and nothing else', () => {
const { gate, workspace } = sharedExecutor('full');
const secret = path.join(os.homedir(), '.ssh', 'id_rsa');
diff --git a/apps/desktop/src/main/remote-agent/executor/__tests__/gitCredentials.git-integration.test.ts b/apps/desktop/src/main/remote-agent/executor/__tests__/gitCredentials.git-integration.test.ts
index 621f76e609..d9e51fbaf4 100644
--- a/apps/desktop/src/main/remote-agent/executor/__tests__/gitCredentials.git-integration.test.ts
+++ b/apps/desktop/src/main/remote-agent/executor/__tests__/gitCredentials.git-integration.test.ts
@@ -253,7 +253,27 @@ describe('GitCredentialHistory', () => {
expect(git('ls-files', '--', '.env')).toBe('');
expect(git('rev-list', '--all', '--reflog', '--objects')).not.toContain(blob);
expect(git('show', blob)).toContain('PRIVATE_FIXTURE=unreachable-content');
- for (const command of ['git show ' + blob, 'git show ' + blob + ' -- README.md']) {
+ for (const command of [
+ 'git show ' + blob,
+ 'git show ' + blob + ' -- README.md',
+ 'git show -s ' + blob,
+ 'git show --name-only ' + blob,
+ ]) {
+ expect(await provesSafe(history, command), command).toBe(false);
+ await requiresCredentialConfirmation(history, command);
+ }
+ });
+
+ it('keeps consent when implicit HEAD names a blob instead of a commit', async () => {
+ const history = new GitCredentialHistory();
+ expect(await provesSafe(history, 'git show')).toBe(true);
+ write('.env', 'PRIVATE_FIXTURE=implicit-blob\n');
+ const blob = git('hash-object', '-w', '.env').trim();
+ git('update-ref', 'refs/tags/fixture-blob', blob);
+ git('symbolic-ref', 'HEAD', 'refs/tags/fixture-blob');
+ for (const args of [[], ['-s'], ['--name-only'], ['--', 'README.md']]) {
+ expect(git('show', ...args)).toContain('PRIVATE_FIXTURE=implicit-blob');
+ const command = 'git show ' + args.join(' ');
expect(await provesSafe(history, command), command).toBe(false);
await requiresCredentialConfirmation(history, command);
}
@@ -304,6 +324,75 @@ describe('GitCredentialHistory', () => {
}
});
+ it('keeps consent when --bare selects a different repository in the same directory', async () => {
+ const history = new GitCredentialHistory();
+ expect(await provesSafe(history, 'git show HEAD')).toBe(true);
+ const bare = path.join(root, 'bare');
+ git('init', '--bare', '-q', bare);
+ for (const entry of fs.readdirSync(bare)) {
+ expect(fs.existsSync(path.join(repo, entry))).toBe(false);
+ fs.cpSync(path.join(bare, entry), path.join(repo, entry), { recursive: true });
+ }
+ write('.env', 'PRIVATE_FIXTURE=bare-history\n');
+ git('--bare', 'config', 'user.email', '[email protected]');
+ git('--bare', 'config', 'user.name', 'Fixture');
+ const blob = git('--bare', 'hash-object', '-w', '.env').trim();
+ const tree = execFileSync('git', ['--bare', 'mktree'], {
+ cwd: repo, encoding: 'utf8', input: '100644 blob ' + blob + '\t.env\n',
+ }).trim();
+ const revision = git('--bare', 'commit-tree', tree, '-m', 'bare fixture').trim();
+ git('--bare', 'update-ref', 'HEAD', revision);
+ git('--bare', 'config', 'http.extraHeader', 'PRIVATE_FIXTURE=bare-config');
+ expect(git('show', 'HEAD', '--')).not.toContain('PRIVATE_FIXTURE=bare-history');
+ expect(git('--bare', 'show', 'HEAD')).toContain('PRIVATE_FIXTURE=bare-history');
+ expect(git('config', '--list')).not.toContain('PRIVATE_FIXTURE=bare-config');
+ expect(git('--bare', 'config', '--list')).toContain('PRIVATE_FIXTURE=bare-config');
+ for (const command of ['git --bare show HEAD', 'git --bare config --list']) {
+ expect(await provesSafe(history, command), command).toBe(false);
+ await requiresCredentialConfirmation(history, command);
+ }
+ });
+
+ it('keeps consent for attached, abbreviated and clustered config-source flags', async () => {
+ const file = path.join(root, 'alternate.config');
+ fs.writeFileSync(file, '[http]\nextraHeader = PRIVATE_FIXTURE=alternate-config\n');
+ const blob = git('hash-object', '-w', file).trim();
+ const history = new GitCredentialHistory();
+ expect(await provesSafe(history, 'git config --list')).toBe(true);
+ for (const args of [
+ ['-f' + file, '--list'],
+ ['-lf' + file],
+ ['--fil=' + file, '--list'],
+ ['--fil', file, '--list'],
+ ['--blo=' + blob, '--list'],
+ ['--fil', file, 'http.extraHeader'],
+ ['--file', file, '--type', 'path', 'http.extraHeader'],
+ ['-f' + file, '--type', 'path', 'http.extraHeader'],
+ ['--blo', blob, 'http.extraHeader'],
+ ]) {
+ expect(git('config', ...args)).toContain('PRIVATE_FIXTURE=alternate-config');
+ const command = 'git config ' + args.map((arg) => JSON.stringify(arg)).join(' ');
+ expect(await provesSafe(history, command), command).toBe(false);
+ await requiresCredentialConfirmation(history, command);
+ }
+ });
+
+ it('keeps consent for implicit config reads with value-taking options and stdin sources', async () => {
+ const history = new GitCredentialHistory();
+ expect(await provesSafe(history, 'git config --type path user.name')).toBe(true);
+ git('config', 'user.password', 'PRIVATE_FIXTURE=implicit-config');
+ expect(git('config', '--type', 'path', 'user.password')).toContain('PRIVATE_FIXTURE=implicit-config');
+ await requiresCredentialConfirmation(history, 'git config --type path user.password');
+ if (process.platform === 'win32') return;
+ const input = '[http]\nextraHeader = PRIVATE_FIXTURE=stdin-config\n';
+ for (const args of [['--fil', '/dev/stdin', 'http.extraHeader'], ['-f/dev/stdin', '--type', 'path', 'http.extraHeader']]) {
+ const output = execFileSync('git', ['config', ...args], { cwd: repo, input, encoding: 'utf8' });
+ expect(output).toContain('PRIVATE_FIXTURE=stdin-config');
+ const command = "printf '[http]\\nextraHeader = PRIVATE_FIXTURE=stdin-config\\n' | git config " + args.join(' ');
+ await requiresCredentialConfirmation(history, command);
+ }
+ });
+
it('does not exempt a git read after an earlier shell segment may change state', async () => {
const history = new GitCredentialHistory();
expect(await provesSafe(history, 'git add -A && git diff --cached')).toBe(false);
diff --git a/apps/desktop/src/main/remote-agent/executor/gitCredentials.ts b/apps/desktop/src/main/remote-agent/executor/gitCredentials.ts
index 2328974d9f..6aaa0914f2 100644
--- a/apps/desktop/src/main/remote-agent/executor/gitCredentials.ts
+++ b/apps/desktop/src/main/remote-agent/executor/gitCredentials.ts
@@ -345,6 +345,7 @@ async function revisionsAreCovered(
): Promise<boolean> {
const revisions = revisionOperands(read);
if (!revisions) return false;
+ if (read.sub === 'show' && revisions.length === 0) revisions.push('HEAD');
for (const revision of revisions) {
const remaining = deadline - Date.now();
if (remaining <= 0) return false;
@@ -382,17 +383,22 @@ async function shownFilesArgs(read: GitRead, cwd: string): Promise<string[] | nu
const resolves = (spec: string) => git(['rev-parse', '--verify', '--quiet', spec], cwd).then(() => true, () => false);
const separator = read.args.indexOf('--');
let insertAt = separator < 0 ? read.args.length : separator;
+ let sawCommit = false;
for (let index = 0; index < insertAt; index += 1) {
const arg = read.args[index];
if (arg.startsWith('-')) continue;
const range = arg.split(/\.\.\.?/);
if (range.length > 1) {
- for (const side of objectsMustBeCommits ? range.filter(Boolean) : []) {
- if (!(await resolves(`${side}^{commit}`))) return null;
+ for (const side of objectsMustBeCommits ? range : []) {
+ if (!(await resolves((side || 'HEAD') + '^{commit}'))) return null;
}
+ sawCommit = objectsMustBeCommits;
+ continue;
+ }
+ if (await resolves(`${arg}^{commit}`)) {
+ sawCommit = true;
continue;
}
- if (await resolves(`${arg}^{commit}`)) continue;
if (await resolves(arg)) {
if (objectsMustBeCommits) return null;
continue;
@@ -400,6 +406,7 @@ async function shownFilesArgs(read: GitRead, cwd: string): Promise<string[] | nu
// 既不是提交也不是别的对象、又是存在的路径:git 从这里起都按路径处理。
if (await exists(path.resolve(cwd, arg))) insertAt = index;
}
+ if (read.sub === 'show' && !sawCommit && !(await resolves('HEAD^{commit}'))) return null;
if (!cannotTakeNextAsValue(read.args[insertAt - 1])) return null;
return [listing.sub, ...read.args.slice(0, insertAt), ...listing.args, ...read.args.slice(insertAt)];
}
@@ -449,7 +456,12 @@ function configEntryHoldsSecret(key: string, value: string): boolean {
* (系统、全局、仓库,含 include)核对它会打出的那些项里没有密钥。读别的配置文件(-f / --blob)的不核对。
*/
async function configReadProvesSafe(read: GitRead): Promise<boolean> {
- if (!read.cwd || read.args.some((arg) => /[$`]/.test(arg) || /^(?:-f|--file|--blob)(?:=|$)/.test(arg))) return false;
+ const configSources = ['--file', '--blob', '--global', '--system', '--local', '--worktree'];
+ if (!read.cwd || read.args.some((arg) => {
+ if (/[$`]/.test(arg) || /^-[^-]*f/.test(arg)) return true;
+ const name = arg.split('=')[0].replace(/^--no-/, '--');
+ return name.startsWith('--') && name.length > 2 && configSources.some((option) => option.startsWith(name));
+ })) return false;
const cwd = await fsp.realpath(read.cwd);
const key = requestedConfigKey(read);
const entries = (await git(['config', '--list', '-z'], cwd)).split('\0').filter(Boolean);
diff --git a/docs/product-rules/provider-sharing.md b/docs/product-rules/provider-sharing.md
index b0178f3c46..470c8b6b93 100644
--- a/docs/product-rules/provider-sharing.md
+++ b/docs/product-rules/provider-sharing.md
@@ -291,23 +291,28 @@ Desktop「设置 → 模型供应商」的左栏(2026-10-08 用户裁决):
都保留确认,不用改写后的文件名或上次核实的链接目标放行;
- 按扩展名缩小范围的搜索不算读取凭证:rg 的 `-g '*.ts'`、grep 的 `--include='*.md'` 这类只选中源码
与文档文件的写法,字面上能选中 `.env.ts`、`id_rsa.ts`,但这类名字是代码模块。直接写出像凭证的
- 文件名、`*.json` / `*.txt` / `*.sh` 这类可能存放凭证的格式、扩展名不确定的写法(`*.ts*`)仍要确认;
+ 文件名、`*.json` / `*.txt` / `*.sh` 这类可能存放凭证的格式、扩展名不确定的写法(`*.ts*`)仍要确认。
+ 搜索启用跟随符号链接(如 rg 的 `--follow` / `-L`、grep 的 `-R` / `--dereference-recursive`)时,
+ 源码扩展名不能证明链接目标非敏感,保留确认;短选项组合与可接受的长选项缩写同样处理;
- git 查看内容的命令(`git diff`、`git show`、`git log -p`、`git grep`)只看命令文本时按可能读到
提交进仓库的凭证处理,执行前先在受邀者电脑上核实,读不到凭证类文件就不弹卡:仓库所有分支、标签、
stash 与 reflog 的历史和暂存区里从没有凭证类文件;或命令用 `--` 限定的路径碰不到这些文件;或
(`git diff` / `git show` / `git log`)按原命令只列出会显示的文件,其中没有凭证类文件。认不出 git
在哪个仓库里跑、仓库带子模块、比较仓库外的文件、核实超过 8 秒,都照旧弹卡;仓库的扫描结果留在
内存里给后面的命令用。指定的对象必须能解析为提交且已在扫描范围内,否则改按实际显示的文件
- 核对;无法证明为提交的底层对象(如 `git show <blob-id>`)保留确认,不能按干净历史放行。所有
+ 核对;无法证明为提交的底层对象(如 `git show <blob-id>`,含 `-s` / `--name-only` 等输出选项及隐式
+ `HEAD`)保留确认,不能按干净历史放行。所有
历史与内容探针禁用 replacement refs;仓库有 `refs/replace` 或宿主设置了 `GIT_REPLACE_REF_BASE`
时不授予内容豁免,避免探针与实际命令使用不同对象;
- 打出 git 配置的命令(`git remote -v` / `get-url` / `show`、读 `git config`、`git var -l`)按受邀者
电脑上生效的 git 配置核实:要打出的那些项里没有密钥(地址里嵌的令牌或密码、`http.extraHeader`、
- 密码与令牌类配置项)就不弹卡,有才确认;
+ 密码与令牌类配置项)就不弹卡,有才确认;显式切换配置文件、blob 或配置作用域(含附着参数、短选项
+ 组合与长选项缩写)不授予豁免,以免核实的是另一套配置;带取值的选项与单键隐式读取也要核实,
+ 不能把选项的取值计入写配置的参数数目而绕过确认;
- 上述 Git 核实仅用于命令段直接调用 PATH 中的裸 `git`,且沿用宿主环境、PATH 各项为绝对目录时。
显式执行文件路径(如 `./git`)、`git.exe`、任何命令包装器(包括 `env`、`command`、`exec`),以及
环境变量的赋值、移除或清空(含 PATH、加载器与 Git 配置来源)都无法与探针证明一致,照旧弹卡;
- 前面的命令段可能修改 Git 状态、运行环境,或写法认不出时也不能豁免。
+ `--bare` 这类改变仓库上下文的选项、前面的命令段可能修改 Git 状态、运行环境,或写法认不出时也不能豁免。
- 再收紧(2026-10-12 用户裁决),同样只用于分享任务:命令里直接写着密钥(`https://用户:密码@`、
地址里的令牌、`Authorization` 头的取值、常见服务的令牌格式与私钥)、用 `<提交>:<路径>` 写出凭证类文件
(`git show HEAD:.aws/credentials`)、`git credential fill` 这类打出保存的登录凭证的命令都要确认。
diff --git a/packages/maker-core/src/agents/shared/auto-review.test.ts b/packages/maker-core/src/agents/shared/auto-review.test.ts
index e66316172b..8d15644a2a 100644
--- a/packages/maker-core/src/agents/shared/auto-review.test.ts
+++ b/packages/maker-core/src/agents/shared/auto-review.test.ts
@@ -10,7 +10,7 @@ import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync } from 'node:fs
import { tmpdir } from 'node:os';
import { join } from 'node:path';
-import { describe, expect, it } from 'vitest';
+import { describe, expect, it, vi } from 'vitest';
import {
classifyShellCommand,
@@ -4827,6 +4827,61 @@ describe('shellCommandReadsCredentials — 分享任务的附加选项', () => {
}
});
+ it('keeps sharing source searches behind consent when they follow symbolic links', () => {
+ for (const command of [
+ "rg --follow -g '*.ts' token .",
+ "rg -nL -g '*.ts' token .",
+ "grep -Rn --include='*.md' token .",
+ "grep --dereference-recursive --include='*.md' token .",
+ "grep --dereference-r --include='*.md' token .",
+ "egrep -Rn --include='*.md' token .",
+ "fgrep --dereference-r --include='*.md' token .",
+ "ag -uf token .",
+ ]) {
+ const localDecision = shellCommandReadsCredentials(command, roots);
+ expect(shellCommandReadsCredentials(command, roots, { sourceFileSelectors: false }), command).toBe(localDecision);
+ expect(shellCommandReadsCredentials(command, roots, { sourceFileSelectors: true }), command).toBe(true);
+ }
+ });
+
+ it('marks sharing Git probes unsafe when --bare changes the repository context', () => {
+ for (const subcommand of ['show HEAD', 'config --list']) {
+ const command = 'git --bare ' + subcommand;
+ expect(shellCommandReadsCredentials(command, roots), command).toBe(subcommand === 'show HEAD');
+ const collect = vi.fn(() => false);
+ expect(shellCommandReadsCredentials(command, roots, { gitContentRead: collect, gitConfigRead: collect }), command).toBe(true);
+ expect(collect, command).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({
+ cwd: undefined,
+ priorSegmentsMayMutate: true,
+ }));
+ }
+ });
+
+ it('checks sharing implicit config reads even when flags take positional values', () => {
+ for (const command of [
+ 'git config --fil /tmp/config http.extraHeader',
+ 'git config -f/tmp/config --type path http.extraHeader',
+ 'git config --type path user.password',
+ ]) {
+ expect(shellCommandReadsCredentials(command, roots), command).toBe(false);
+ const collect = vi.fn(() => false);
+ expect(shellCommandReadsCredentials(command, roots, { gitConfigRead: collect }), command).toBe(true);
+ expect(collect, command).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ sub: 'config' }));
+ }
+ });
+
+ it('checks sharing git show object types even when patch output is suppressed', () => {
+ for (const command of ['git show -s deadbeef', 'git show --name-only deadbeef', 'git show --no-patch']) {
+ expect(shellCommandReadsCredentials(command, roots), command).toBe(false);
+ const collect = vi.fn(() => false);
+ expect(shellCommandReadsCredentials(command, roots, { gitContentRead: collect }), command).toBe(true);
+ expect(collect, command).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ sub: 'show' }));
+ }
+ const collect = vi.fn(() => false);
+ expect(shellCommandReadsCredentials('git show -s HEAD:src/app.ts', roots, { gitContentRead: collect })).toBe(false);
+ expect(collect).not.toHaveBeenCalled();
+ });
+
it('gitContentRead:git 查看内容先问调用方,并带上 git 实际运行的目录', () => {
const reads: GitRead[] = [];
const record = (read: GitRead) => {
diff --git a/packages/maker-core/src/agents/shared/auto-review.ts b/packages/maker-core/src/agents/shared/auto-review.ts
index 897c7451a8..23184bd6f6 100644
--- a/packages/maker-core/src/agents/shared/auto-review.ts
+++ b/packages/maker-core/src/agents/shared/auto-review.ts
@@ -5711,6 +5711,20 @@ function agSearchesPotentialCredential(args: readonly string[]): boolean {
return hidden && recursive && !filenameOnly;
}
+function searchFollowsSymlinks(bin: string, args: readonly string[]): boolean {
+ for (const token of args) {
+ if (token === '--') break;
+ if (bin === 'rg' && (token === '--follow' || /^-[^-]*L/.test(token))) return true;
+ if (bin === 'ag' && (token === '--follow' || /^-[^-]*f/.test(token))) return true;
+ if (bin === 'grep' || bin === 'egrep' || bin === 'fgrep') {
+ if (/^-[^-]*R/.test(token)) return true;
+ const name = token.split('=')[0];
+ if (name.startsWith('--') && '--dereference-recursive'.startsWith(name)) return true;
+ }
+ }
+ return false;
+}
+
function rgSearchesPotentialDotenv(
args: readonly string[],
selectorCouldMatch: (value: string) => boolean = selectorCouldMatchCredential,
@@ -6163,10 +6177,9 @@ function gitPrintsConfig(sub: string, args: readonly string[]): boolean {
if (sub !== 'config') return false;
if (args.some((arg) => GIT_CONFIG_READS.test(arg))) return true;
if (args.some((arg) => GIT_CONFIG_WRITES.has(arg))) return false;
- // 只写了键名的是读取(`git config user.name`),键名加取值是写入;-f / --blob 的取值不算。
+ if (args.some((arg) => arg.startsWith('-') && arg !== '--')) return true;
const positionals = args.filter((arg) => !arg.startsWith('-')).length;
- const fileValues = args.filter((arg) => arg === '-f' || arg === '--file' || arg === '--blob').length;
- return positionals - fileValues <= 1;
+ return positionals <= 1;
}
/**
@@ -6204,13 +6217,14 @@ function gitConfigReadOf(
}
/**
- * 这些 Git 全局选项会在本次调用里改变配置来源或配置值。执行器的核实命令不带它们,
+ * 这些 Git 全局选项会在本次调用里改变仓库上下文、配置来源或配置值。执行器的核实命令不带它们,
* 因而不能把核实结果套到实际调用上;分享任务直接保留凭证确认卡。
*/
function gitUsesConfigOverride(tokens: readonly string[]): boolean {
for (let index = 1; index < tokens.length; index += 1) {
const token = tokens[index];
if (token === '--') break;
+ if (token === '--bare') return true;
if (token === '-c' || token.startsWith('-c') && !token.startsWith('-C')) return true;
if (token === '--config-env' || token.startsWith('--config-env=')) return true;
}
@@ -6399,7 +6413,9 @@ function shellCommandReadsDotenv(
|| gitArgumentsReadDotenv(credentialArgs)) {
return true;
}
- if (gitContentReadWithoutPath(invocation.sub, invocation.args)
+ const probesShowObject = opts.gitContentRead !== undefined && invocation.sub === 'show'
+ && !gitShowHasOnlySafeObjectPaths(invocation.args);
+ if ((gitContentReadWithoutPath(invocation.sub, invocation.args) || probesShowObject)
&& classifyGit(tokens, segment, workspaceRoots, opts) === 'auto-approve'
&& !opts.gitContentRead?.({
sub: invocation.sub,
@@ -6417,6 +6433,7 @@ function shellCommandReadsDotenv(
}
if (readsCredentialInput) return true;
const args = tokens.slice(1);
+ if (opts.sourceFileSelectors && searchFollowsSymlinks(bin, args)) return true;
if (grepRecursesIntoPotentialDotenv(bin, args, selectorCouldMatch)) return true;
if (bin === 'ag' && agSearchesPotentialCredential(args)) return true;
if (bin === 'rg' && rgSearchesPotentialDotenv(args, selectorCouldMatch)) return true;