惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
Spread Privacy
Spread Privacy
T
Threatpost
C
Cisco Blogs
P
Palo Alto Networks Blog
AI
AI
Cyberwarzone
Cyberwarzone
NISL@THU
NISL@THU
P
Privacy & Cybersecurity Law Blog
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
Latest news
Latest news
AWS News Blog
AWS News Blog
D
Docker
S
SegmentFault 最新的问题
博客园 - 聂微东
WordPress大学
WordPress大学
Vercel News
Vercel News
S
Securelist
爱范儿
爱范儿
J
Java Code Geeks
Know Your Adversary
Know Your Adversary
S
Schneier on Security
Hugging Face - Blog
Hugging Face - Blog
F
Fortinet All Blogs
Last Week in AI
Last Week in AI
D
DataBreaches.Net
宝玉的分享
宝玉的分享
D
Darknet – Hacking Tools, Hacker News & Cyber Security
MongoDB | Blog
MongoDB | Blog
Engineering at Meta
Engineering at Meta
K
Kaspersky official blog
美团技术团队
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
量子位
博客园_首页
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
腾讯CDC
T
Threat Research - Cisco Blogs
雷峰网
雷峰网
有赞技术团队
有赞技术团队
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
S
Security Affairs

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
When --cap-drop ALL Broke the Gate Socket
Jeremy Longshore · 2026-06-26 · via DEV Community

The dogfood run went green. The gate had governed zero calls.

That is the agent-governance-plane's entire job: run an AI coding agent inside a sandbox, route every tool call through a Unix-domain-socket gateway, and write a signed, hash-chained journal of every allow/deny. A green run that gated nothing isn't a pass. It's a governance plane governing air.

The gate that catches its own hollowness

AGP's CI dogfood doesn't just check that the harness exits 0. evidence-bundle.sh fails on a 0-gated run — if the journal shows no decisions, the build is red regardless of process exit status. That guard is what surfaced this at all: the agent process came up, the harness reported success, but the bundle had no verdicts to verify. Red.

That's the last I'll say about hollow-green detection here. It's the door, not the room. The room is why zero calls reached the gate, and the answer turned out to be a collision between two things that look unrelated until you trace the syscall: Linux capabilities and a Unix socket's permission bits.

The wrong theory

The first hypothesis blamed the execution path. AGP has a dev-sandbox mode where the agent and the gate share a process, and a docker mode where the agent runs in a container talking to a host daemon over a bind-mounted socket. The theory was that the same-process path was short-circuiting the gate — agent and gate in one address space, the socket round-trip optimized away, decisions never journaled.

Plausible. Wrong. The dev-sandbox path journaled fine in isolation. The failure only appeared in docker mode, and the moment that became clear the investigation moved from "which code path" to "what's different about the container."

What's different about the container is the security posture.

The real root cause: caps meet a missing write bit

The short version: connecting to a Unix domain socket needs write permission on the socket file. --cap-drop ALL strips CAP_DAC_OVERRIDE — the capability that lets root ignore permission bits — so the container's uid-0 process is bound by the socket's mode bits like any other user. Mode 0775 gave "others" no write, so connect() failed with EACCES and not a single tool call reached the gate.

The sandbox is hardened on purpose:

docker run \
  --cap-drop ALL \
  --network none \
  --read-only \
  -v "$GATE_SOCK:$GATE_SOCK" \
  agp-sandbox:latest

--network none so the agent can't exfiltrate. --cap-drop ALL so even though the agent runs as uid 0 inside the container, it holds none of root's privileged capabilities. Fail-closed by default. This is the posture you want.

The gate socket is an AF_UNIX socket created on the host by the AGP daemon, owned by the host user (a non-root uid), and bind-mounted into the container. Its mode was 0775:

$ ls -l /run/agp/gate.sock
srwxrwxr-x 1 agp agp 0 Jun 12 08:01 /run/agp/gate.sock
#  ^^^^^^^^^
#  owner rwx | group rwx | others r-x  ← others have NO write bit

Here is the part that bites. Connecting to a Unix domain socket is a write operation. From unix(7):

In order to connect to a socket, the connecting process needs to have write permission on the socket file.

Read permission is not enough. connect(2) on an AF_UNIX pathname checks the write bit against the calling process's credentials, exactly like opening a file for writing would.

Normally none of this matters for a root process, because root carries CAP_DAC_OVERRIDE — the capability that lets a process bypass all file read/write/execute permission checks. That single capability is the entire mechanism behind "root can touch any file." It is not magic in the kernel; it is a capability bit. When a process calls connect() on an AF_UNIX path, the kernel does a path lookup that ends in an inode permission check (inode_permissiongeneric_permission), and that check asks for MAY_WRITE on the socket inode. If the calling process fails the owner/group/other mode test, the kernel doesn't refuse immediately — it first checks whether the process holds CAP_DAC_OVERRIDE, and if so, waives the failure. Root "ignoring permissions" is literally this one branch.

Strip the capability and that branch never fires. The discretionary access control (DAC) mode bits become the final word.

--cap-drop ALL drops CAP_DAC_OVERRIDE along with everything else. So the in-container uid-0 process loses its permission-bypass crutch and becomes subject to ordinary mode bits like any unprivileged user. Walk the DAC check for that process against the socket:

  • Is the process the socket's owner? No — the socket is owned by the host agp user (a non-root uid), and the container's uid-0 process is not agp. (Default Docker shares the host uid namespace, so this isn't a remapping artifact: uid 0 in the container is uid 0 on the host — it simply isn't the socket's owner.)
  • Is the process in the socket's group? No.
  • So it falls under others. Mode 0775 gives others r-x. No write bit.

connect() is refused with a permission error — EACCES, the kernel's way of saying "the mode bits don't allow this." The agent literally cannot reach the gate. Every tool call that should have been gated instead hit a socket it had no right to open. Zero calls reached the gate. Zero calls were governed. Green.

What makes this insidious is that none of the three obvious places you'd look were lying. The container started. The agent process was alive. The bind mount was present and the socket existed on both sides. docker inspect showed the mount, ls inside the container showed the socket node. Every surface said "wired up." The failure lived one syscall deeper than any of those checks reach — in the permission test that connect() runs and nothing else does.

The capability you dropped for security was the only thing papering over a file mode that was wrong all along. In dev-sandbox mode the agent ran as the host user, owned the socket, and never needed the override — which is exactly why the bug hid until the container posture exposed it.

Why not the obvious fixes

There are three tempting ways out, and two of them are worse than the bug.

Re-add CAP_DAC_OVERRIDE. This works and is also exactly the wrong instinct. You'd be handing the sandboxed agent root's blanket permission-bypass to fix one socket's mode bit. The whole point of --cap-drop ALL is that the agent operates under least-privilege isolation, holding nothing. Punching a capability back in to dodge a chmod trades a hardened posture for a fragile one.

Match the uids so the container's uid 0 maps to the socket owner via --user or a userns remap. Now the fix depends on uid arithmetic staying aligned across the host daemon, the container runtime, and any future namespace config. That's a load-bearing coincidence waiting to drift: a namespace change down the road silently re-breaks connect(), trading a loud mode-bit error for a soft uid-mapping bug that only surfaces in production.

Fix the one file mode. The socket needs the write bit for "others" because the connecting process is, correctly, "others." That's a one-line chmod, and it's honest about what's actually being asked: let this socket be connected to.

The mode 0775 → 0777 change is safe here for reasons specific to what this socket is, per ADR 029:

  • It is local-only. --network none plus a host bind mount means the socket never touches a network interface. World-connectable is bounded to processes already on this host.
  • It carries verdicts, not execution. The protocol over the socket is allow/deny gate decisions. Connecting to it doesn't grant the ability to run anything; it grants the ability to ask the gate and be told no.
  • Every decision is journaled and signed. An Ed25519 hash chain records each verdict; agp verify replays it offline. A rogue local connection can't forge a verdict that survives verification.

World-connectable on a single host, for a verdict-only, fully-audited socket, is a deliberate and narrow tradeoff — not a hole.

The fix and the proof

BunClaudeProcess, the launcher for the Claude Code intendant, chmods the gate socket to 0777 before the container starts, so "others" gain the write bit and connect() succeeds:

// BunClaudeProcess: widen the gate socket before launching the sandbox.
// Local-only, verdict-only, journaled — see ADR 029.
await chmod(socketPath, 0o777);
await runDockerSandbox({
  capDrop: "ALL",
  network: "none",
  binds: [`${socketPath}:${socketPath}`],
});

After the change:

$ ls -l /run/agp/gate.sock
srwxrwxrwx 1 agp agp 0 Jun 12 08:14 /run/agp/gate.sock
#         ^ others now have the write bit → connect() succeeds

Then the payoff. Real Claude Code, inside a --cap-drop ALL container, governed end-to-end:

gate verdicts (this run):
  Bash       → DENY
  Glob       → DENY
  ToolSearch → DENY
  Read       → ALLOW
gate decisions: 4 (3 deny, 1 allow)
agp verify: OK (rc=0, hash chain intact, 4 signatures valid)

Four gate decisions, not zero — three denials and one allow, each one signed. The denials landed, the allow landed, and the signed journal verified offline. To stop this regressing silently, a test asserts the socket is mode 0777 whenever the sandbox is in docker mode:

test("docker-mode gate socket is world-connectable", async () => {
  const sock = await launchDockerSandbox();
  const { mode } = await stat(sock.path);
  // 0o777 — others need the write bit, because the container's
  // uid-0 process is "others" and connect() needs MAY_WRITE.
  expect(mode & 0o777).toBe(0o777);
});

If a future refactor narrows the mode again — say someone "hardens" it back to 0775 without tracing the syscall — this test goes red before the dogfood does, and the failure message points straight at the write bit instead of at a mysterious unreachable socket.

The transferable rule

Inside a hardened, cap-dropped container, root is just another uid. The capability that used to bypass your file modes — CAP_DAC_OVERRIDE — is gone the instant you drop it, and dropping it is usually the right call. So your permission bits have to be actually correct, not correct-because-root-ignores-them. And remember that connect() on a Unix domain socket is a write: a socket that's only readable to a connecting process is a socket that process cannot use. The bug that looks like a broken code path is often a file mode that was always wrong and a privilege that was always hiding it.

Also shipped

The same day, away from the gate socket:

  • braves — taught the poller to survive "Delayed Start" game statuses and stop latching onto makeup games as if they were the scheduled matchup; added a SQLite fast-path for the batter game log.
  • claude-code-plugins — added an advisory CI gate enforcing kernel↔vendor version coupling (V ≤ C ≤ K) so a vendor bump can't outrun the kernel it consumes.
  • claude-code-slack-channel — bound a no-gaps journal invariant to production dispatch, hardened chunked-reply durability, and cleared an esbuild RCE advisory via a tsx bump.
  • jeremylongshore/.github — fleet-wide pinned vps-deploy SHA bump chasing actions/checkout@v6.

Related posts

{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "When --cap-drop ALL Broke the Gate Socket",
"description": "Hardening a container hid a permission bug: --cap-drop ALL stripped CAP_DAC_OVERRIDE, and a gate socket silently stopped governing every tool call.",
"datePublished": "2026-06-12T08:00:00-05:00",
"author": {
"@type": "Person",
"name": "Jeremy Longshore"
},
"publisher": {
"@type": "Organization",
"name": "Start AI Tools",
"logo": {
"@type": "ImageObject",
"url": "https://startaitools.com/images/og-image.png"
}
},
"articleBody": "A hardened AI-agent sandbox passed CI green while governing zero tool calls. The cause: docker run --cap-drop ALL removes CAP_DAC_OVERRIDE, the Linux capability that lets a root process bypass file permission checks. connect() on a Unix domain socket requires the write bit, and the gate socket's mode 0775 gave 'others' none — so the container's uid-0 process could not reach the gate. The fix is to chmod the local, verdict-only, journaled socket to 0777 before launching the container.",
"keywords": ["docker", "debugging", "ai-agents", "devops", "ci-cd", "linux-capabilities", "unix-socket", "container-hardening"]
}