Skip to content

feat(security): define network approval contract#921

Closed
luoye520ww wants to merge 1 commit into
KunAgent:developfrom
luoye520ww:codex/network-approval-contract
Closed

feat(security): define network approval contract#921
luoye520ww wants to merge 1 commit into
KunAgent:developfrom
luoye520ww:codex/network-approval-contract

Conversation

@luoye520ww

Copy link
Copy Markdown
Collaborator

Problem

Network access needs an approval contract separate from file permissions so shell, MCP, and connectors can enforce the same policy later.

Scope

This PR only adds pure request normalization and grant matching. It does not change shell execution, web fetch, MCP transport, or UI.

Changes

  • Define
    one, �pproved, and ull modes.
  • Support one-call and host-port grants.
  • Separate read from mutation permissions.
  • Require explicit localhost approval even for approved mode.
  • Normalize hosts and reject malformed requests, grants, modes, and unknown fields.

Validation

pm.cmd --prefix kun test -- src/contracts/network-approval.test.ts (4 passed)

pm.cmd run typecheck (passed)

pm.cmd --prefix kun run typecheck (passed)

pm.cmd run lint (passed)

pm.cmd run build (passed)

  • git diff --check (passed)

Review

Completed functional, lifecycle, data integrity, security, cross-platform, compatibility, test quality, and scope review. The contract performs no DNS, socket, or process operations.

Follow-ups

Shell and MCP network enforcement, audit records, and renderer approval UI should be separate PRs.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated provider/network safeguards PR #948, which passed Typecheck, Linux, macOS, and Windows packaged checks. Closing this duplicate to keep the review surface focused.

@luoye520ww luoye520ww closed this Jul 14, 2026
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