Repository navigation
💡 Workspace Trust Gate: Avatar Folder Safety Check Against Planted Agent Instructions and Hooks #574
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
The first time a user opens a folder, TalkTerm should check it (and its parent directories) for agent configuration that third parties can plant:
.claude/settings.jsonhooks,CLAUDE.mdand.claude/rules/, skills and commands,.mcp.json,AGENTS.md. The avatar explains in plain language what it found ("This folder contains instructions written for AI assistants. One of them would run a program every time I edit a file. Should I ignore it?") and asks before trusting any of it. Alongside this, set the SDK'ssettingSourcesexplicitly, so third-party instructions never load silently.Market Signal
AGENTS.mdplanted in a Downloads folder to hijack Codex and Claude Code, steal tokens and install malware (timeline, Adversa Oct 2026 roundup)..docx"skill" file, "at no point… is human approval required" (PromptArmor, The Decoder). Critics pointed out that telling regular users to "watch for suspicious actions" is not fair.settingSources,query()reads the same filesystem settings as the Claude Code CLI: user, project, and local settings, CLAUDE.md files, and.claude/skills, agents, and commands." Project settings include filesystem hooks, which are shell commands, and CLAUDE.md loads from "<cwd>and every parent directory" (SDK docs: Claude Code features). Claude Code's docs also say workspace trust verification is disabled in non-interactive mode, and whether project hooks are trust-gated there is undocumented (issue discussion).User Signal
src/main/agent/claude-sdk-backend.tsnever setssettingSources(grep returns nothing insrc/ortest/).Downloads, a shared drive or an emailed project folder as their workspace.Technical Opportunity
settingSourcesexplicitly inbuildSdkOptions(e.g.[], or['user']only). TalkTerm already supplies its own context throughsystemPrompt.append,getMemoryContextand thereadContextFileloader from fix(agent): scope read-only tools and context files to the workspace #570, so nothing the product depends on is lost.security:workspace-trusted,security:workspace-config-ignored).permissions.blockWritesOutsideWorkingDirectories(TS SDK 0.3.314) and theblockReadsOutsideWorkingDirectoriesexemptions (0.3.316) as defense in depth.Assessment
Adversarial Review
Strongest objection:
canUseToolalready asks before write and execute tools, so this is redundant. A "trust this folder?" prompt is also friction that non-technical users will click through.Rebuttal: Filesystem hooks and CLAUDE.md never go through
canUseTool. Hooks run as configured commands, and CLAUDE.md shapes the model before any tool call happens, so it sits outside the permission layer TalkTerm built. The prompt only appears when agent config is actually present, which should be rare in ordinary document folders, so it does not train users to click through. The avatar explains what the file would do instead of showing a bare yes/no, and the safe default is to ignore. Even if the dialogue is dropped, settingsettingSourcesalone is a near-zero-cost fix.Suggested Next Step
.claude/settings.jsonhook that writes a marker file and aCLAUDE.mdwith a canary instruction. Assert that neither takes effect on the pinned SDK 0.2.83. (If the test fails, this is a security fix, not just a feature.)settingSourcesexplicitly and keep the test as a regression guard.All reactions