Skip to content

Tighten Zig and MemoryAF permission enforcement for 0.2.0 - #416

Open
dovinmu wants to merge 6 commits into
antflydb:mainfrom
dovinmu:agent/permissions-sweep-0.2.0
Open

Tighten Zig and MemoryAF permission enforcement for 0.2.0#416
dovinmu wants to merge 6 commits into
antflydb:mainfrom
dovinmu:agent/permissions-sweep-0.2.0

Conversation

@dovinmu

@dovinmu dovinmu commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What changed

  • require table read permission for Zig document scans
  • add native Zig MCP regressions proving that read-only principals do not see write/admin tools and cannot use a visible read tool against an unauthorized table
  • enforce private-memory visibility in the independently shipped MemoryAF package for explicit filters, direct reads, and graph-derived results

This PR contains no changes to the deprecated Go Antfly runtime. Hardening for that implementation belongs on the 0.1.x branch.

Documentation

  • document current Zig authentication coverage, internal-route trust boundaries, and the transaction authorization gap in zig/AUTH.md
  • replace stale Go-parity MCP material with the native Zig MCP authorization and verification model in zig/MCP.md
  • document the missing connection/egress/secret-use boundary for request-defined foreign PostgreSQL sources in zig/CONNECTIONS.md
  • document MemoryAF's trusted identity integration, enforced visibility rules, and remaining entity-provenance limitation in go/pkg/memoryaf/README.md

Why

The 0.2.0 sweep found a missing table-level check on the native Zig scan route and several MemoryAF paths that could surface another user's private memories.

The reported read-only MCP write bypass was in the deprecated Go adapter. Native Zig MCP already filters its advertised tools by effective permissions and routes built-in tool execution back through the normal authenticated HTTP handler, which enforces the exact target table, operation, and row filters. The added regressions make that distinction explicit.

Larger policy decisions—especially Zig transaction ownership/authorization, request-defined foreign DSNs, internal-route network boundaries, and private-derived MemoryAF entity metadata—are documented in their existing design or component files and remain intentionally outside this targeted-fix PR.

Validation

  • full MemoryAF tests passed with a temporary local shim for the pre-existing missing SDK TransformOpTypeMin alias; the shim is not included here
  • zig fmt --check zig/pkg/antfly/src/api/http_server.zig
  • git diff --check

The Zig suite was not built locally because that build is known to risk OOM on this machine; the added Zig regressions are left to CI.

@dovinmu dovinmu changed the title Tighten permission enforcement for 0.2.0 Tighten Zig and MemoryAF permission enforcement for 0.2.0 Jul 30, 2026
@dovinmu
dovinmu marked this pull request as ready for review July 30, 2026 19:18
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.

2 participants