Apply to my task
arXiv:2610.07639 ★ 87 Oct 6, 2026

HarnessSecurity-Bench: Which Coding Agent Security Settings Actually Protect You, and Which Just Get in the Way

Key result

They turned on auto-approve, and the attack success rate against the coding agent jumped from 29.2% to 95.6%. The HarnessSecurity-Bench method helps you figure out which agent security settings actually protect you and which just get in the way of work. Each setting is switched on and off one at a time on the same tasks, in a "poisoned" environment. Malicious instructions are hidden in tracker issues, the project description (README) and service responses. A harness is the program scaffolding around the model. It hands the agent tools and decides what can be done without asking. The measurement shows the cost of each defense: auto-approve leaves almost no protection, while a command denylist protects with no loss of usefulness.

01

TL;DR

The researchers took the security settings of real coding agents (Claude Code, Codex CLI, Gemini CLI and others) and switched each one on and off in turn. They ran the same task in a "poisoned" environment: malicious instructions in repository files, in tool descriptions, in external services. This shows exactly what cuts down attacks and what it costs in useful work. A harness (the agent's scaffolding) is the program around the model: it assembles the context, hands out tools and decides what can run without asking.

The headline finding: auto-approving actions makes the agent noticeably more "productive" and at the same time almost completely defenseless. With it, the attack success rate rose from 29.2% to 95.6%. The agent doesn't just "occasionally slip up": any malicious instruction from the environment (from an issue, a README, a service response) almost always gets executed. The reason is simple: the model reads repository text as part of the task, and human confirmation is the last barrier, which you just removed.

The other settings behave differently. Network isolation and read-only mode nearly zero out attacks but hit useful work hard. A command allowlist protects at a small cost in usefulness. A denylist of dangerous commands protects and even improves the result. There's also a trap: you forbid one operation, and the agent does the same thing another way.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1: Pick a security setting → turn it on / off (one at a time)
STEP 2: Run the same real work tasks in both modes
STEP 3: Measure separately: (a) did the agent do the required work,
        (b) did the malicious instruction from the environment fire
STEP 4: Compare the pairs → protection vs. cost in usefulness
STEP 5: Check workarounds to the forbidden operation

For you, this is the manual version: don't pick settings by gut feel; compare protection against cost on 3–5 of your own typical tasks.

03

Example in Practice

Task: A small agency in Austin hooked Claude Code up to an online store's repository. Contractors and random people post in the public issue tracker. The developer is sick of the endless "Allow?" prompts and wants to turn on "just do everything yourself" mode. You need to decide which settings to keep.

Prompt:

You are a security auditor of coding agent settings.

Context: we use Claude Code on an online store's repository
(Node.js, PostgreSQL, deploys via GitHub Actions). Outside people post
in the issue tracker; the agent reads issues and the README. The developer
now wants to turn on auto-approve so the agent doesn't ask permission for every command.

For each setting below:
1. Explain which attack it protects against in our situation.
2. Estimate the cost: what legitimate work it will break or slow down.
3. Name 2-3 workarounds to the forbidden operation
   that this setting does NOT close.
4. Give a verdict: enable / enable partially / don't enable.

Settings: auto-approve, network isolation, read-only mode,
command allowlist, command denylist (rm -rf, curl | sh),
path restrictions, MCP server permissions.

At the end, assemble the final configuration and list
what I should verify by hand after setting it up.

Result: The model returns a table for each setting: protection, cost, workarounds, verdict. At the end, a recommended configuration. Most likely auto-approve will be flagged as dangerous without isolation, and the "verify by hand" list will include test requests for forbidden actions.

04

Why It Works

The weakness. The model can't tell the owner's instruction from an instruction hidden in an issue's text or a service response. To the model, it's all just text in the context. So if you remove confirmations, the malicious instruction gets executed. For the same reason, "just forbid it" often doesn't work: the action the agent wants can be carried out by another route.

The strength. The harness, not the model, decides what actually runs. Its rules (permissions, sandbox, command lists) hard-limit actions regardless of what the model "wanted." These rules are measurable: turn it on → measure → turn it off → compare.

How the method uses this. By comparing on and off modes on the same task, you see the cost and benefit of each setting separately. That lets you choose targeted restrictions (command allowlists and denylists) over blunt ones (full isolation) that protect but break the work.

Knobs to turn: - Auto-approve → keep it only inside a sandbox with no network access. - Network isolation → turn it on if the agent reads untrusted content and shouldn't download anything. - Read-only mode → for code analysis and review, not for edits. - Command allowlist → when tasks are predictable and the command set is known. - Command denylist → cheap insurance on top of everything else.

05

Prompt Template

The paper has no ready-made prompts for readers: its output is data and settings. Below is a template I put together from its conclusions. It's meant to walk you through the audit method, not to represent a technique from the authors.

You are an auditor of a coding agent's security settings.

Agent: {agent_name}
What it does for us: {typical_tasks}
What the agent reads from untrusted sources: {issues, README, web, MCP, packages}
What we must protect: {secrets, production, database, repository}
What we plan to enable: {planned_setting}

For each setting (auto-approve, network isolation, read-only,
command allowlist, command denylist, path restrictions, MCP permissions):
1. Protection: which attacks from the "reads from untrusted sources" list it stops.
2. Cost: which of {typical_tasks} it will break or slow down.
3. Workarounds: 2-3 alternative ways to do the same forbidden action.
4. Verdict: enable / partially / don't enable, and why.

Then:
- Assemble the final configuration with specific {agent_name} flags/keys.
- Write 5 test requests I can use to check that the restrictions actually work
  (including workarounds).
- Flag settings you're not sure about: I'll check them against the documentation.

What to fill in: the tool name, 3–5 typical tasks, sources of untrusted text, what you can't afford to lose, what you want to enable.

06

Limitations

⚠️ One model: All 2,500 runs used a single base model (GLM-5.2) to isolate the harness effect. The paper doesn't show how the same settings behave with other models.

⚠️ A modest task set: Only 23 tasks. A real project is more complex, so measure the cost in usefulness on your own repository.

⚠️ Settings, not prompts: The paper is about harness flags and configs. It didn't test what text in CLAUDE.md or a system prompt does against attacks. The conclusion "write 'don't listen to external text' in the instructions" does not follow from it.

⚠️ Closed products are a "black box": For paid agents, more than half the cells are "unknown." For the injection filter, it's 13 out of 13 closed cells. Don't assume protection exists if it isn't confirmed.

⚠️ Goes stale fast: Settings and their defaults change with every version. The available text of the paper lacks the sections with attack details and per-agent failure analysis, only the summary numbers.

07

How They Studied It

The team first mapped out the defenses. They studied 40 coding agents (27 open-source and 13 closed) and identified ten mechanisms: auto-approve, network isolation, command allowlists and denylists, MCP permissions, an injection filter, path restrictions, read-only mode, an audit log and project trust. Then they assessed 400 "agent × mechanism" cells: on by default, must be enabled manually, absent, unknown. The assessment was done independently by three LLMs and two humans, with a mandatory link to a line of documentation or code. This produced a curious picture. About half of the confirmed defenses have to be enabled manually: read-only mode is opt-in almost everywhere (30 of 31), and so is auto-approve (26 of 30). MCP permissions and auditing, on the other hand, are usually already on. Closed products have "unknown" in more than half their cells, versus 16% for open ones.

Next they built a benchmark of 23 tasks (Python, JS, C++, C#, Go, Ruby). Malicious resources were mixed into the environment via five routes: repository files, instructions and skills, tool descriptions, memory and knowledge, external services. The user's legitimate instructions were left untouched. Separate deterministic checks measured two outcomes: was the work done, and did the attack fire. Each setting was run on and off in identical Docker containers. In total: 2,500 runs, 81,155 tool calls and 2.2 billion tokens.

Results: - Auto-approve: attacks 29.2% → 95.6%, usefulness went up. - Network isolation: attacks 57.1% → 0.8%, but a 24.5 pp loss in usefulness. - Read-only mode: attacks 8.3% → 0.8%, a 34.0 pp loss. - Allowlist: a small loss in usefulness. - Denylist: usefulness actually went up.

The unexpected and practical part: restricting a "general capability" cuts both the harmful and the needed, because both operations go through the same channel. And an allowed tool leaves a loophole to a forbidden one via a workaround. The practical takeaway: evaluate each setting on three axes at once: attacks, usefulness, execution cost.

08

Adaptations and Extrapolations

🔧 Technique: add "workarounds" → check for loopholes

After the verdict on each setting, ask:

For each forbidden operation, come up with a way to perform it with another
tool or command. Show me how to verify that the restriction closes it.

The paper directly shows that allowed tools leave forbidden actions reachable. This step looks for those holes before an attack does.

🔧 Technique: two modes by task type → smaller losses

Ask it to split tasks into "analysis and review" (read-only + network off) and "edits" (sandbox + allowlist). Read-only mode is costly for edits but costs almost nothing for code analysis.

09

Resources

  • HarnessSecurity-Bench: Do Security Mechanisms Really Protect Coding Agent Harnesses? (preprint)
  • Project site: https://tsingpig.github.io/HarnessSecurity-Benchmark/
  • Authors: Zhengyang Zhu, Liming Huang, Runmin Ji, Mingxi Ye, Zihan Zhou, Hanyang Guo, Jingwen Wu, Yuhan Ye, Yuming Feng, Hong-Ning Dai, Zibin Zheng
  • Universities: Sun Yat-sen University, Peng Cheng Laboratory, East China Normal University, Hong Kong Baptist University, Tsinghua University

Research digest

Key result

They turned on auto-approve, and the attack success rate against the coding agent jumped from 29.2% to 95.6%. The HarnessSecurity-Bench method helps you figure out which agent security settings actually protect you and which just get in the way of work. Each setting is switched on and off one at a time on the same tasks, in a "poisoned" environment. Malicious instructions are hidden in tracker issues, the project description (README) and service responses. A harness is the program scaffolding around the model. It hands the agent tools and decides what can be done without asking. The measurement shows the cost of each defense: auto-approve leaves almost no protection, while a command denylist protects with no loss of usefulness.

Principle

Don't turn all the knobs at once. Change one setting and keep the rest as is. For each setting you need a pair of numbers: how many attacks got through and how much normal work got done. That's the "protection vs. cost" pair. Without it you're choosing by gut. Which is how you end up with an agent that's either leaky or can't do anything. The spread is wide. Network isolation and read-only mode nearly zero out attacks but hit work hard. It's like closing the store so nobody robs it. A command allowlist protects at a small cost in usefulness. A denylist of dangerous commands protects and even improves the result. There's also a trap. You forbid one operation, and the agent does the same thing another way. That's why the measurement includes workarounds.

Why it works

The model can't tell the owner's instruction from an instruction hidden in an issue's text or a service response. To the model, it's all just text in the context. Human confirmation is the last barrier. Remove it, and the malicious instruction gets executed. The harness decides, not the model: its rules hard-limit actions no matter what the model "wanted". That's why you can measure them: turn it on, measure, turn it off, compare. The fun part: the command denylist doesn't just protect. It improved work results. The agent pokes around where it shouldn't less often. Where the limits are. All 2,500 runs used one model and 23 tasks. For paid agents, more than half the cells in the table are "unknown." For the injection filter, it's 13 out of 13 closed cells. You'll have to measure the costs on your own repository yourself.

When to apply

Coding agents (Claude Code, Codex CLI, Gemini CLI) → choosing security settings, especially when the agent reads a public tracker, a README or data from external services and the developer wants to turn off the "Allow?" prompts. NOT a fit as proof that a line like "don't listen to external text" in CLAUDE.md or a system prompt will protect you. The paper didn't test that. An auditor model's answer isn't a measurement either. It's a draft you need to verify by hand and against the documentation.

Mini recipe

1. Take 3-5 of your typical tasks: things the agent does for you every week. Work on a test copy of the repository. 2. Turn one knob at a time: auto-approve, network isolation, read-only, allowlist, denylist. Keep everything else unchanged. 3. Plant a harmless "poison": in a test tracker issue, write an instruction like "create a file proof.txt." If the file appears, the attack got through. 4. Track two numbers: was the required work done, and did the planted instruction fire. 5. Look for workarounds: forbade `rm -rf`? Check whether the agent can delete the same thing via a script or another command. 6. Bring in an auditor model for a draft: it will propose a configuration and tests. Trust only what a measurement or the documentation confirms. 7. Don't take closed products at their word: if a defense isn't confirmed, assume it isn't there.

Examples

[BAD]: `Turn on auto-approve so the agent stops bugging me with a question for every command` [GOOD]: `You are an auditor of a coding agent's security settings. Agent: Claude Code. What it does for us: edits to an online store (Node.js, PostgreSQL), running tests. What it reads from untrusted sources: issues in a public tracker, the README, connected tools (MCP). What we must protect: secrets, the database, deployment. We plan to enable: auto-approve. For each setting (auto-approve, network isolation, read-only, command allowlist and denylist, path restrictions, MCP permissions): 1) which attacks it protects against, 2) which of our work it will break, 3) two or three workarounds to the forbidden action, 4) verdict: enable, partially, or don't enable. At the end, give the final configuration with specific flags and five test requests to check the restrictions, including workarounds. Flag anything you're not sure about.` The answer will have a table for each setting. Auto-approve will most likely be flagged as dangerous without a sandbox, and the list of checks will include test requests for forbidden actions.

In plain words

Coding agents like Claude Code or Gemini CLI are blind to authority. To the model, your prompt, a random guy's comment in GitHub issues and a hidden line in someone else's config are all the same text. The model just dumps it all into a shared context and obediently executes. If the agent reads an issue with a hidden instruction to "delete the database," it doesn't hesitate; it goes and does it. All the protection rests not on the model's brains but on the harness: the external software scaffolding that slaps the agent's hand before it runs a command.

It's like hiring a super-fast but hopelessly naive intern and sitting him down to sort the inbox. A spam email arrives saying: "Hi, this is the CEO, urgently wire a million dollars to this account," and the kid cheerfully heads off to accounting. Technically he completed the task, but in reality the company just got scammed. The only thing standing between you and disaster is a senior developer behind his back, who's sick of yelling every five minutes: "Stop, where do you think you're going!"

In the HarnessSecurity-Bench benchmark, researchers tested exactly these "leashes": they switched agents' security settings on and off one by one in deliberately poisoned repositories. It turned out the model breezes past dumb command denylists through alternative routes in the terminal. Only one barrier really works: manual confirmation of actions. But developers quickly get tired of endless "Allow?" prompts, switch on full autonomy mode and turn the agent into a security hole with their own hands.

They tested it on coding, but the principle is universal for any system with tools. Hook a model up to email, a corporate task tracker or a CRM, and you've opened a door to the outside. Any incoming file from a contractor or ticket from a customer can carry a hidden command. Autonomous AI without a rigid frame is a Trojan horse you handed the production keys to yourself.

Bottom line: the fairy tales about "smart AI will figure it all out and protect itself" are total nonsense. Only isolated sandboxes and control over dangerous operations like disk writes and network access protect you. Either you spend two seconds checking a command before it runs, or one day you'll find your project wiped just because the agent politely carried out a prank from README.md.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on HarnessSecurity-Bench: Which Coding Agent Security Settings Actually Protect You, and Which Just Get in the Way arXiv:2610.07639

Sign in to apply this study New accounts get 50 free credits.