AI 개발

AI Agent 권한 제어는 어떻게? 2026 Schema·Sandbox·Tool Policy와 4층 JSON 보안 모델

약 16분

권한은 allow 목록 한 장이 아니다. 2026년 AI Agent를 JSON으로 묶으려면 네 층이 일반적이다: Schema, Tool Permission(allow/ask/deny·SDK·managed sub-agent), Runtime Sandbox(Claude Bash sandbox, OpenShell network_policies), Agent Identity·감사. Coding Agent 권한 입문의 풀스택 후속이며 OpenShell MCP L7 심층 글의 복제가 아니다.

읽기 전 요약

층 2026 제품 사실 JSON에서 볼 것
① Schema 실행 전 호스트가 draft 2020-12 등으로 input 검증; Agents API/MCP parameters pattern, additionalProperties, required
② Tool Policy Claude Code permissions JSON; managed agents always_allow/always_ask/auto; SDK permission_mode allow, ask, deny, eval_order
③ Sandbox 세션 Bash sandbox; OpenShell binary별 egress+생성 시 Landlock(network hot reload) per_binary, egress_default, sandbox_id
④ Audit tool 결정마다 agent id, session, sandbox, 층별 verdict layers.schema, layers.permission, outcome
Harness schema·manifest·policy·audit 파일 분리—blob 하나에 넣지 말 것 messages vs state

사실 기준 2026-11-07: Claude Code 권한·Bash sandbox, OpenAI Agents SDK permission_mode, NVIDIA OpenShell network_policies. A-1042, sb_agent_demo_7f3a는 가상.

Agent 권한 제어 = Schema + Policy + Sandbox + 감사, 4층 JSON

입문 글은 세션 allow/ask/deny(Bash/Read/Git)—harness 문이다. 모델은 여전히 잘못된 order_id, sub-agent, 미등록 host로 runner가 나갈 수 있다. 2026 풀스택은 네 층 직렬:

  • Schema 층: tool마다 JSON Schema, additionalProperties: false와 A-1042 패턴; 실패 시 permission 평가 전 중단.
  • Policy 층: manifest에서 deny→ask→allow; managed Explore/Plan은 always_allow/always_ask/auto; SDK acceptEdits 등.
  • Sandbox 층: IDE Bash sandbox는 workspace; 프로덕션 worker는 OpenShell network_policies로 어느 binary—채팅 Allow는 outbound 등록 대체 아님.
  • 감사 층: schema 결과, permission match, sandbox egress, agent.identity를 한 이벤트에.

권한 입문: coding agent 권한 모델. OpenShell runtime·MCP egress: OpenShell runtime sandbox(본문은 per-binary network만). Harness state: agent harness와 JSON state. Schema 이유: AI가 JSON Schema를 쓰는 이유. Agents API: OpenAI Agents API와 JSON Schema.

바깥 감사→sandbox→policy—Schema가 먼저

Schema는 인자 객체. MCP arguments와 Claude tool_use.input 모두 호스트 검증 후 전달. Permission은 도구·명령 패턴. Bash(git push *) deny 우선; mcp__orders default allow는 Schema 대체 아님. Sandbox는 프로세스·네트워크 사실. 미등록 /opt/agent/runner는 새 host egress 불가. Landlock은 생성 시 고정. Identity/감사는 추적. agent.id, session_id 필수. Claude Bash sandbox와 OpenShell JSON 분리—allow 한 줄로 합치지 말 것.

층마다 JSON 한 덩어리—message에 우겨 넣지 말 것

1. Tool input Schema(1층). 등록/MCP capabilities 시 바인딩; lookup_order input 실행 전 검증:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "lookup_order_input",
  "type": "object",
  "additionalProperties": false,
  "required": ["order_id"],
  "properties": {
    "order_id": {
      "type": "string",
      "pattern": "^[A-Z]-[0-9]{4}$",
      "description": "Warehouse order id, e.g. A-1042"
    },
    "include_line_items": {
      "type": "boolean",
      "default": false
    }
  }
}

2. Permission manifest(2층). repo/세션; managed sub-agent·SDK mode. eval_order 주의:

{
  "version": "2026-09",
  "permission_mode": "default",
  "eval_order": ["deny", "ask", "allow"],
  "managed_agents": {
    "Explore": "always_allow",
    "Plan": "always_ask",
    "BashReview": "auto"
  },
  "tools": {
    "Bash": {
      "default": "ask",
      "sandbox": "workspace-write",
      "rules": [
        { "pattern": "git status", "decision": "allow" },
        { "pattern": "git diff *", "decision": "allow" },
        { "pattern": "git push *", "decision": "deny" }
      ]
    },
    "Edit": { "default": "ask" },
    "mcp__orders": { "default": "allow" }
  },
  "sdk": {
    "permission_mode": "acceptEdits",
    "bypass_permissions": false
  }
}

3. OpenShell network_policies 발췌(3층). binary별 egress; Landlock은 여기서 hot 변경 안 함—OpenShell 글 참고:

{
  "network_policies_version": "2026.11",
  "hot_reload": true,
  "per_binary": [
    {
      "binary": "/opt/agent/runner",
      "egress_default": "deny",
      "allow": [
        { "host": "orders.example.com", "port": 443, "path_prefix": "/mcp" }
      ]
    },
    {
      "binary": "/usr/bin/python3",
      "egress_default": "deny",
      "allow": [
        { "host": "pypi.org", "port": 443 }
      ]
    }
  ],
  "landlock_note": "filesystem_policy applies at sandbox create, not via this file"
}

4. 감사 이벤트(4층). 성공 호출의 네 층 verdict를 harness tool_use와 맞춤:

{
  "event_id": "evt_9c2f8a01",
  "ts": "2026-11-07T06:22:11Z",
  "agent": {
    "id": "agt_codereview_v3",
    "session_id": "sess_7f3a",
    "identity": "service-account:ci-bot",
    "sandbox_id": "sb_agent_demo_7f3a",
    "supervisor": "openshell-sandbox"
  },
  "layers": {
    "schema": { "tool": "lookup_order", "valid": true, "validator": "draft-2020-12" },
    "permission": { "decision": "allow", "matched": "mcp__orders", "rule": "default" },
    "sandbox": { "binary": "/opt/agent/runner", "egress": "allowed" }
  },
  "tool_use_id": "toolu_order_01",
  "input_digest": "sha256:8f3e…",
  "outcome": "executed"
}

Schema·Policy·Sandbox·감사—한 층이 전체인 척 하지 말 것

「Schema만 엄격」「permissions가 git push deny」만으로 충분하다고 착각하기 쉽다. 층별 객체와 단독 시 구멍:

층 막는 것 이것만 있을 때
JSON Schema input/arguments 형태 유효 인자도 git push·미등록 runner egress
Tool Permission 도구명, Bash 패턴, managed agent, SDK mode IDE Allow 한 번≠binary outbound 등록
Runtime Sandbox 프로세스, Landlock, binary별 egress sandbox는 order_id 패턴 안 봄—Schema 일
Audit / Identity 누가, 어느 session/sandbox, 층별 결과 감사 없으면 증명·misconfig Diff 불가

세션 권한: coding agent 권한 모델. OpenShell outbound·lifecycle: OpenShell runtime sandbox. 인자 철학: AI가 JSON Schema를 쓰는 이유—네 층은 누적.

다섯 단계로 네 층을 버전 관리 가능한 JSON으로

가상 주문 A-1042를 staging에서 통과 후 policy 확장:

  1. tool마다 Schema 파일, OpenAPI/MCP와 동일 출처; CI sample validate.
  2. Permission manifest를 repo에; deny를 allow 앞; managed는 always_ask 명시.
  3. 세션 sandbox와 runtime 분리: 로컬 Claude Bash·workspace; 서버 OpenShell FS, network_policies 별 버전.
  4. append-only 감사; schema/permission/sandbox 하위 객체 고정해 JSONPath.
  5. 거절은 네 층 횡단: schema_valid→permission→egress→identity가 예상 bot과 일치.

다섯 가지가 Diff 가능 JSON이면 order_id, deny, 미등록 binary, 감사 누락을 구분.

거절·「allow인데 안 돌아감」일 때 JSON 네 종류 펼치기

model tool_use만 보지 말고 manifest, network_policies, 최신 audit 병렬.

  • Schema·manifest·policy·audit 포맷; input Schema 검증로 A-1042.
  • JSONPath 추출로 $.tools.Bash.rules[*].pattern, $.per_binary[*].binary, $.layers.permission.matched.
  • manifest/policy 전후 JSON Diff; deny·egress_default 우선.
  • Claude /permissions; OpenShell openshell logs --tail --source sandbox.
  • audit/manifest token 마스킹; JSONSort 브라우저 로컬.

네 가지 정렬되면 Schema·deny·미등록 binary·sub-agent always_allow 구분.

흔한 오류

  • Schema만, manifest 없음. 유효 인자로도 위험 Bash/MCP.
  • 프로덕션 SDK bypass_permissions. 평가 환경 전용—4층 JSON 대체 아님.
  • 채팅 Allow로 OpenShell 등록 대체. runner binary는 harness에 없음.
  • managed agent 암묵 always_allow. Explore는 도구 면 확대—부모는 always_ask.
  • 감사가 tool_result 텍스트만. layers.* 없으면 당시 Schema/sandbox 증명 불가.
  • 본문으로 OpenShell MCP L7 글 대체. 풀스택+per-binary만; L7 tools/call은 OpenShell 글.

FAQ

ai-coding-agent-permissions-json과 차이?

그 글은 세션 권한 입문. 본문은 Schema, runtime sandbox, managed agent, SDK, 감사 JSON 추가 풀스택.

Schema는 모델 vs 호스트?

호스트(또는 게이트웨이)만. strict 출력은 보조일 뿐 additionalProperties/pattern 대체 아님.

Claude Bash sandbox vs OpenShell?

둘 다. 개발기 workspace vs 서버 runner·Landlock·per-binary egress. JSON 분리.

managed_agents auto?

always_ask와 always_allow 사이 제품 자동. 프로덕션 Plan/BashReview에 always_ask 또는 deny 명시.

감사 JSON 보관?

컴플라이언스 따름. Diff에 tool_use_id, identity, layers, outcome. 장기 저장 전 PII 마스킹.

결론

안정적 Agent 권한 제어는 네 층 JSON: Schema·Policy·Sandbox·감사가 각자 역할.

권한 입문 allow/ask/deny 정렬 후 본문 분리 파일; L7은 OpenShell, harness/Schema는 각 글—만능 allow 한 장 금지.

더 읽기

변경 이력: 초판