feat: Platform-Agnostic Review Mode — True Dual-Context Isolation (Issue #17)#102
feat: Platform-Agnostic Review Mode — True Dual-Context Isolation (Issue #17)#102Steffen025 wants to merge 1 commit intomellanon:mainfrom
Conversation
Implements True Dual-Context isolation for safely analyzing untrusted code contributions, addressing all 7 CaMeL security gaps (C-1 through H-4). Architecture: - HMAC-SHA256 TypedReferences for secure content passing - Hook-enforced tool allowlist (Read/Grep/Glob only in quarantine) - Sliding window rate limiter (100 calls/min, 5 concurrent agents) - Buffered JSONL security event logging with sensitive data redaction - Platform adapters for OpenCode (throw Error) and Claude Code (exit 2) - Quarantine agent spawn with timeout management and response parsing Test coverage: - 364 tests across 18 test files, all passing - 123 unit tests (HMAC, TypedReference, SessionManager) - 63 integration tests (hooks, rate limiting, platform compat) - 82 integration tests (quarantine spawn, isolation, timeout) - 85 adversarial tests (8 attack scenarios: AS-001 through AS-008) - 11 performance benchmarks (all NFRs exceeded by 100-2500x) - 89.26% line coverage Documentation: - docs/README.md: Integration guide with quick start - docs/ARCHITECTURE.md: 4 ADRs, component diagrams, data flow - docs/SECURITY.md: Threat model with 10 attack scenarios Closes mellanon#17
|
Hey @Steffen025 — impressive work on this. We're reviewing the review-mode implementation now. One governance note: pai-collab requires commit signing with Ed25519 SSH keys (see Quick setup: git config --global gpg.format ssh
git config --global user.signingKey ~/.ssh/id_ed25519.pub
git config --global commit.gpgSign trueThen amend or rebase to re-sign. Once we see your public key, we'll add it to The implementation itself looks thorough — will share detailed review feedback separately. |
Architecture Note: Code Lives in Your Own Repo@Steffen025 — first, the work here is impressive. 364 tests, adversarial coverage, platform adapters for both OpenCode and Claude Code, HMAC-based typed references — this is serious security engineering. However, there's an architectural pattern in pai-collab that this PR doesn't follow, and it's worth redirecting before we go further. pai-collab is a coordination surface, not a code repository. From the README:
The pattern that all shipped projects follow:
What we'd suggest instead
This way:
See This PR would stay open as a reference, or you can close it and re-submit the registration PR once the repo is set up. Either way, the work isn't lost — it just needs to live in the right place. Happy to help with the registration PR or spoke setup if useful. |
Registers pai-review-mode as a standalone tool on the blackboard. Source: Steffen025/pai-review-mode Type: infrastructure License: MIT Status: alpha True Dual-Context isolation for safely processing untrusted code contributions. HMAC-SHA256 TypedReferences, hook-enforced tool allowlist, platform adapters for OpenCode and Claude Code. 364 tests, 89.26% coverage, 8 adversarial attack scenarios. Previously developed as contributions/review-mode (PR mellanon#102). Relocated per blackboard architecture pattern: code in contributor repos, blackboard tracks coordination.
|
Thanks @mellanon — understood on both points. Architecture redirect: Done. Code is now at Steffen025/pai-review-mode and the blackboard registration is submitted as PR #105 (README + PROJECT.yaml + JOURNAL following the existing project pattern). Commit signing: Ed25519 SSH signing is configured. My public key needs to be added to This PR can be closed as superseded by #105 (registration) + the standalone repo. Happy to close it myself or leave it as reference — your call. |
|
SSH Signing Public Key for Already uploaded to GitHub as signing key. Commits from |
Summary
Implements a complete Platform-Agnostic Review Mode prototype that enables AI coding agents to safely analyze untrusted code contributions using True Dual-Context isolation. This addresses all 7 security gaps identified in the CaMeL framework review (C-1, C-2, C-3, H-1, H-2, H-3, H-4).
Closes #17
Architecture: True Dual-Context
throw Error()) and Claude Code (exit(2))Components (39 files, ~10,800 lines)
Source (
src/) — 15 filestypes.ts,hmac-ops.ts,typed-reference.ts,session-manager.tsreview-mode-hook.ts,tool-allowlist.ts,rate-limiter.ts,security-logger.tsopencode-adapter.ts,claude-code-adapter.tsspawn-template.ts,response-parser.ts,timeout-manager.ts,agent-metadata.tsTests (
tests/) — 21 files, 364 testsDocumentation (
docs/) — 3 filesREADME.mdARCHITECTURE.mdSECURITY.mdCaMeL Security Gaps Addressed
Test Results
Performance Benchmarks
How to Run
Known Limitations
Both are documented in
docs/SECURITY.mdwith analysis and future mitigation paths.Related PRs
This is part of a broader security contribution effort: