Repository navigation
fix(security): isProvablyReadOnly fail-closed on contradictory annotations + max-stale config guard (PR#56 CodeRabbit follow-up) - #67
Conversation
…sProvablyReadOnly, maxStale>=refresh guard, explicit wireName Addresses the 3 CodeRabbit change-requests on the merged PR #56 (B1). Verified each against current main (a2df2c4) — all 3 still valid; fixed red-first. (1) SECURITY (Major) — isProvablyReadOnly fail-closed veto (catalog.ts): the old returned true on CONTRADICTORY annotations — {readOnlyHint:true, mutates:true} passed as provably-read-only, letting a compromised backend keep a WRITE tool alive past the max-stale fail-closed drop (S6). Fix: veto via isMutating() FIRST, then require an affirmative read-only assertion — which also guarantees the documented invariant (isProvablyReadOnly ⟹ !isMutating, now test-enforced). Strictly-more-restrictive: it only DROPS more tools past the horizon, cannot create exposure. (2) DATA-INTEGRITY (Minor) — maxStaleSeconds>=refreshSeconds guard (index.ts): reject at config-parse time; otherwise a tool could be both 'fresh' and 'past max-stale', firing the drop on still-fresh tools. (3) CORRECTNESS (Minor) — explicit wireName (catalog.ts + index.ts): the wire name was inferred by stripping a '<serverId>:' prefix from surfacedName — wrong when a tool's natural name legitimately starts with '<serverId>:' (e.g. server 'kg' exposing 'kg:search' → mis-stripped to 'search', hitting the wrong tool). Added a wireName field to CatalogEntry preserving the ORIGINAL descriptor name; index.ts uses it directly (no inference). Red-first tests added for all 3 (contradictory-annotation combos + the RO⟹!mutating invariant; maxStale<refresh throws; wireName preserves a 'kg:search' name). 120 tests pass (catalog+index+governor), tsgo clean, oxfmt clean. Off fresh main a2df2c4. Generated-With: Claude Code Co-Authored-By: cto <[email protected]> Co-Authored-By: Claude <[email protected]>
|
The formal models extracted constants ( This check is informational (not blocking merges yet). If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Disabled knowledge base sources:
📝 WalkthroughWalkthroughThe Syntropy MCP catalog now preserves original tool wire names, applies fail-closed read-only classification, and rejects configurations with a maximum stale period shorter than the refresh interval. Regression tests cover each behavior. ChangesSyntropy MCP catalog and configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Addresses the 3 actionable CHANGES_REQUESTED findings from merged PR #56, all re-verified valid on current main, fixed red-first. Key: isProvablyReadOnly returned true on contradictory {readOnlyHint:true, mutates:true} — a compromised backend could keep a WRITE tool alive past the stale horizon; now isMutating() vetoes first, invariant isProvablyReadOnly ⟹ !isMutating test-enforced. Strictly more restrictive (fail-closed). Plus maxStaleSeconds>=refreshSeconds parse guard.
🤖 Generated with Claude Code
Summary by CodeRabbit