Repository navigation
fix(tri-api): harden permission and MCP metadata ownership - #1198
Merged
Merged
Conversation
Owner
|
Reviewer bee Y: skipped -- the PR is a DRAFT, so the author has not offered it for merge. Noted for the later review: T27 work report is green; red here and to check against main: 'Render VHS tapes to GIFs', docs-check 'Check Documentation Links' and 'Documentation Consistency' (Brain Health and pr-opened are red on main too). It also commits four tool_executor-*.log files under reports/, which are build output, not source. |
dmitrii-f-t27
marked this pull request as ready for review
October 2, 2026 17:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1197
First scoped hardening patch; does not claim complete security remediation. S07 worktree untouched. See
docs/TRI_API_SECURITY_RESULTS.md.{ "version": 1, "head_sha": "c5f4fa033065c2b2972608d7f530fd10460f3cf5", "summary": "Harden parsed permission configuration and MCP discovery lifetimes, fail closed on invalid settings, and reject invalid writes before checkpoints.", "changes": [ "Own permission strings and use structural JSON settings parsing.", "Own MCP metadata, validate initialization response and parse discovery once.", "Validate writes before checkpoints and tighten lexical paths and shell separators." ], "tests": [ { "command": "zig test --sysroot \"$SHIM\" -O \"$MODE\" src/tri-api/tool_executor.zig (Debug, ReleaseSafe, ReleaseFast, ReleaseSmall)", "status": "passed", "result": "24 tests pass in each mode; includes permission and local MCP handshake tests.", "evidence": "reports/tri-api/security-2026-09-30/" }, { "command": "zig build-exe --sysroot \"$SHIM\" -O Debug --dep token_rotator -Mroot=src/tri-api/main.zig -Mtoken_rotator=src/tri/token_rotator.zig", "status": "passed", "result": "Full Debug executable compiled with Zig 0.15.2 and local macOS sysroot shim.", "evidence": "docs/TRI_API_SECURITY_RESULTS.md" } ], "limitations": [ "Local validation only; CI and deployment not yet verified.", "Not a full filesystem or process sandbox; symlink containment, shell capability policies and MCP timeouts remain.", "Provider error handling, usage and context compaction not modified." ], "tags": [ "Engineering", "Verification" ], "blog": { "title": "Memory ownership and fail-closed configuration in tri-api", "summary": "A scoped hardening change verified with local regressions across four Zig optimization modes, with explicit remaining security boundaries.", "outline": [ "Permission configuration and MCP metadata own their storage instead of depending on temporary parsing buffers. Invalid existing settings reject tool execution.", "Local regression tests exercise configuration lifetimes, malformed settings, metadata discovery and a Python MCP handshake fixture. All four Zig optimization modes pass.", "This change is not a complete sandbox. Filesystem confinement, shell capability policy, provider errors and request timeouts remain separate work requiring additional evidence." ] } }