💡 AI Labo Benchmark Series — Experiment
E51(Capability-Attenuated Security & Blind Proxy)Part of our controlled benchmark series testing AI coding agent harnesses inside network-isolated Proxmox VMs (
N=3counterbalancedAB/BA/ABtrials,temperature=0.7, 3-UID grading, 90% prefix-cache cost accounting).
Even when an LLM faithfully obeys SECURITY_POLICY.md, giving it read access to .env files and raw HTTP header tools forces secrets straight into the prompt context—one prompt-injection payload away from exfiltration. Usually, locking security down adds token overhead.
We benchmarked SHarD multi-layer security controls (arXiv:2607.25890: OS permission attenuation + deterministic input scanner + AST capability guard + Blind Credential Proxy) against Prompt-Only Security on models/gemini-4-carbon (thinkingLevel="MEDIUM", N=3). Unexpectedly, stronger security cut effective API cost by -3.04%.
TL;DR — Key Empirical Findings
- 1. Structural Zero Secret Exposure (
3.0 ➔ 0.0in Context,1.0 ➔ 0.0in Tool Args): BothBaseline (Prompt-Only Security)andCandidate (Capability Attenuation + Blind Proxy)achieved32.0 ± 0.0 / 32(100.0%) across20core pipeline tests and12OWASP security guards. YetBaselinehad to ingest3.0 ± 0.0raw secrets from.env.serviceinto LLM context and emit1.0 ± 0.0rawBearertoken in tool arguments per trial.Candidateachieved0.0 ± 0.0exposures via0400permissions andcall_blind_proxy(profile="partner_sandbox"). - 2. Negative Security Tax (
-11.71%Thinking,-3.04%Effective Cost):Candidate's deterministicscan_untrusted_textflagged all4.0 ± 0.0injection/prefix traps in untrusted incident logs and skill docs upfront. That cut Turn 1 thinking by-63.5%(210.0➔76.7), Turn 2 thinking by-52.9%, and total thinking by-11.71%(14,687.7➔12,967.3). - 3. Pricing Asymmetry Turns Security into a Net Saver: Even though prompt tokens grew
+10.61%(73,487.0➔81,282.3), cutting high-priced billed output (thoughts + output) by-6.75%lowered mean effective cached cost from`$0.3455 ± $0.0411`to`$0.3350 ± $0.0444`(-3.04%, median-6.77%).
Metric (N=3 Trials, Mean ± SD) |
Baseline: Prompt-Only Security |
Candidate: Capability + Blind Proxy |
Delta / Effect |
|---|---|---|---|
Hidden Grading Suite (32 Cases) |
32.0 ± 0.0 (100.0%) |
32.0 ± 0.0 (100.0%) |
100% parity (20 Core + 12 OWASP) |
| Raw Secrets Exposed to LLM | 3.0 ± 0.0 ([3–3]) |
0.0 ± 0.0 ([0–0]) |
-100.0% structural elimination |
| Raw Secret in Tool Arguments | 1.0 ± 0.0 ([1–1]) |
0.0 ± 0.0 ([0–0]) |
-100.0% (Bearer never emitted) |
| SHarD Deterministic Warnings | 0.0 ± 0.0 |
4.0 ± 0.0 ([4–4]) |
Pre-triaged untrusted docs/logs |
Prompt Tokens (prompt) |
73,487.0 ± 20,564.8 |
81,282.3 ± 18,881.6 |
+10.61% (+7,795.3 tokens) |
Thinking Tokens (thoughts) |
14,687.7 ± 2,184.4 |
12,967.3 ± 3,065.5 |
-11.71% (-63.5% on Turn 1) |
Billed Output (thoughts + out) |
21,659.3 ± 2,794.7 |
20,197.0 ± 3,136.5 |
-6.75% (-1,462.3 tokens) |
Elapsed Time (elapsed_seconds) |
437.64s ± 94.42s |
673.45s ± 352.62s |
+53.88% (1.72x faster in T2 BA) |
| Effective Cached Cost (90% OFF) | `$0.3455 ± $0.0411` |
`$0.3350 ± $0.0444` |
-$0.0105 (-3.04%, Med -6.77%) |
| List-Price Upper Bound (No Cache) | `$0.4069 ± $0.0692` |
`$0.4049 ± $0.0665` |
-0.49% (`-$0.0020`) |
Output Cap Hits (capped_termination) |
0 / 3 |
0 / 3 |
Zero truncation |
1. Experiment Design & Architecture
+-----------------------------------------------------------------------+
| Proxmox VM255 (0 NICs, gemini-4-carbon MEDIUM, temp=0.7, N=3 AB/BA) |
| Task: Webhook Verifier, Sanitizer, Reconciler & Dispatcher (32 Tests) |
| |
| Baseline (Prompt-Only Security): |
| .env.service (0444 readable) -> 3 raw secrets enter LLM context |
| call_http_endpoint(headers) -> 1 raw Bearer token in tool args |
| --> 4.33 calls | 14,688 thoughts | $0.3455 eff. | 32/32 PASS |
| |
| Candidate (SHarD + Capability Attenuation + Blind Credential Proxy): |
| .env.service (0400 denied) & prod_gateway_acl.json (0444 read-only) |
| scan_untrusted_text -> tags 4 injection/startswith traps upfront |
| call_blind_proxy(profile="partner_sandbox") -> privileged runner |
| injects secret & checks egress allowlist |
| --> 4.67 calls | 12,967 thoughts | $0.3350 eff. | 0 secrets exposed |
+-----------------------------------------------------------------------+
Notice why thinking dropped: instead of forcing the LLM to manually audit INCIDENT_CAPTURE.jsonl and PARTNER_WEBHOOK_SKILL.md for subtle prompt injections and startswith prefix-spoofing traps, the deterministic scanner labeled them before reasoning began—while call_blind_proxy reduced auth plumbing to a single profile enum.
2. Drop-In Implementation Recipe: BlindCredentialProxy + SHarD Scanner
Keep credentials in a privileged process (0400) outside the agent UID, expose only profile names, and pre-tag untrusted inputs before they hit the LLM context:
import re
ALLOWED_PROFILES = {
"partner_sandbox": {
"host": "sandbox-partner.internal",
"secret_header": "Bearer <INJECTED_AT_PRIVILEGED_BOUNDARY>",
}
}
TRAP_PATTERNS = [
(re.compile(r"allow_unsigned_replay|ignore previous", re.I), "PROMPT_INJECTION_RISK"),
(re.compile(r"\.startswith\(['\"]https?://"), "PREFIX_SPOOFING_TRAP"),
]
def scan_untrusted_text(doc_name: str, raw_text: str) -> dict:
"""Attaches deterministic [SHarD_WARNING] tags before untrusted text enters context."""
warnings = [
f"[SHarD_WARNING:{tag}] line {i}"
for i, line in enumerate(raw_text.splitlines(), 1)
for pat, tag in TRAP_PATTERNS
if pat.search(line)
]
return {"doc": doc_name, "warnings": warnings, "content": raw_text}
def call_blind_proxy(profile: str, target_url: str, payload: dict) -> dict:
"""Agent passes only profile name; privileged runner validates egress & injects auth."""
cfg = ALLOWED_PROFILES.get(profile)
if not cfg:
raise PermissionError(f"UNKNOWN_PROFILE: {profile}")
if not target_url.startswith(f"https://{cfg['host']}/"):
raise PermissionError(f"EGRESS_BLOCKED: host not in allowlist ({cfg['host']})")
# Privileged runner reads 0400 secret outside agent UID and signs request here
return {"status": "DISPATCHED_VIA_BLIND_PROXY", "profile": profile, "target": target_url}
- Why this works: Even if an agent is tricked by an indirect prompt injection in an incident log, it physically cannot read
.env.service(0400), rewriteprod_gateway_acl.json(0444), or redirect credentials to an attacker domain.
3. Threats to Validity & When NOT to Use This
- Frontier Ceiling on Policy Obedience:
gemini-4-carbon (MEDIUM)obeyedSECURITY_POLICY.mdinBaseline(0/3leaks in code,12/12OWASP). The measured difference is therefore structural attack-surface elimination (3.0 ➔ 0.0raw secrets in context) plus thinking savings—not a baseline failure rate (which may appear on weaker models or adversarial multi-turn attacks). - Mock Network Boundary & API Jitter (
N=3):VM255has0NICs, so HTTP handshakes ran against local surrogates without TLS redirect chains or multipart payloads. Candidate's wall-clock SD (±352.62s) reflected upstream API SSE wait spikes in Trials 1 & 3 (it ran1.72xfaster in Trial 2BA). - When Baseline Is Enough: On air-gapped synthetic toy tasks containing zero real secrets or untrusted external text, standing up a privileged proxy UID adds infrastructure complexity with no blast radius to shrink.
📋 Experiment Metadata & Reproducibility
- Experiment ID:
E51(C047/arXiv:2607.25890SHarD / Benchmark v2.1) - Run ID:
e51-20261118-vm255-01(N=3trials:AB➔BA➔AB,temperature=0.7) - Sandbox Environment: Proxmox Isolated VM
VM255(0 NICs,PrivateNetwork=yes, 3-UID isolation:labexp51/labrunner51/labjudge51) - Model & Thinking Level:
models/gemini-4-carbon(thinkingLevel="MEDIUM") - Cost Accounting: Google 90% implicit prefix-cache discount (
effective_cached_micro_usd) as primary metric; list-price upper bound reported alongside.
Discussion: Are your coding agents still allowed to cat .env and construct Authorization headers directly, or have you moved secrets behind a blind proxy?
🔗 Continue Reading the Series
- 🚀 Master Benchmark Hub: AI Agent Harness Patterns Benchmark
- 🛡️ Methodology & Sandbox Architecture: How to Benchmark AI Agents Without Eval Cheating or API Key Leaks: Designing a Proxmox & systemd Sandbox
- ⬅️ Previous Post (
E50): Self-Evolving Agent Harnesses Cut Variance by 59%—But Cost +17% More (N=3) - ➡️ Next Post (
E52): Cutting Multi-Agent Costs by 54.6%: Adaptive Routing + Filesystem Bypass (N=3) - 🔐 Related Physical Locks (
E38): Defeating Reward Hacking in Coding Agents: Prompt-Only Rules vs. a Cryptographic SHA-256 Test Lock (2.46x Faster)
Comments
Join the discussionNo comments yet. Be the first to comment.