Skip to content

hardening: label requests from AI coding tools - #71

Draft
sorah wants to merge 2 commits into
hardening/caller-identityfrom
hardening/tool-detection
Draft

sorah wants to merge 2 commits into
hardening/caller-identityfrom
hardening/tool-detection

Conversation

@sorah

@sorah sorah commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Implements docs/specs/010-tool-detection.md.

  • a hardened agent labels a request ai-agent from its ancestry (comm, exe, argv[0..1] basenames, pidfd-pinned walk up to 64), environment variable names the client reports (names only), or session marks
  • labels reach Cedar as context.tools / context.tool_matches at both gates; builtin-human excludes ai-agent, and builtin-ai-agent-per-request asks for each such request (or a running mairu exec lease idle at most 1 h)
  • mairu lock --tool <label> marks the terminal session; mairu unlock --tool always asks through the approve-policy action
  • refusals, polkit details, the client's from: line, doctor and the decision log show labels
  • the built-in env-name list adds the variables current agents set (CODEX_THREAD_ID, CURSOR_AGENT, QWEN_CODE, OPENCODE, GOOSE_TERMINAL, AMP_CURRENT_THREAD_ID, COPILOT_CLI, CRUSH)

Verified in Docker (35 checks): requests under fake claude/codex processes or with CLAUDECODE ask every time while a human terminal asks once; mairu exec leases; marked panes; unlock --tool.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Dg17LE9aWqsb1VBUCVcKLM

sorah and others added 2 commits October 31, 2026 09:42
Requests whose ancestry, environment names or terminal session mark
them as an AI coding tool carry the ai-agent label in the Cedar
context, and the built-in policy asks for each of them instead of
reusing the terminal's grant. `mairu lock --tool` marks a session;
`mairu unlock --tool` always asks before removing a mark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dg17LE9aWqsb1VBUCVcKLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dg17LE9aWqsb1VBUCVcKLM
@sorah
sorah added this pull request to stack #63 October 31, 2026 00:43
@sorah sorah changed the title hardening/tool detection hardening: label requests from AI coding tools Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant