Skip to content

fix(security): isProvablyReadOnly fail-closed on contradictory annotations + max-stale config guard (PR#56 CodeRabbit follow-up) - #67

Merged
supmo668 merged 1 commit into
mainfrom
mangyinm/pr56-coderabbit-followup
Jul 14, 2026
Merged

supmo668 merged 1 commit into
mainfrom
mangyinm/pr56-coderabbit-followup

Conversation

@supmo668

@supmo668 supmo668 commented Jul 14, 2026 •

Copy link
Copy Markdown

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

  • Bug Fixes
    • Preserved original tool names when displaying or invoking tools, including names containing a server identifier.
    • Improved read-only detection to reject contradictory or mutation-related annotations.
    • Added validation to prevent stale-cache settings from being shorter than refresh intervals.
  • Reliability
    • Tools with uncertain safety annotations are now handled conservatively.
    • Equal refresh and stale-cache intervals are supported.

…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]>
@github-actions

Copy link
Copy Markdown

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3dd75578-a807-4701-86f9-2a6c64907e36

📥 Commits

Reviewing files that changed from the base of the PR and between a2df2c4 and 94371e4.

📒 Files selected for processing (4)
  • extensions/syntropy-mcp/src/catalog.test.ts
  • extensions/syntropy-mcp/src/catalog.ts
  • extensions/syntropy-mcp/src/index.test.ts
  • extensions/syntropy-mcp/src/index.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

The 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.

Changes

Syntropy MCP catalog and configuration

Layer / File(s) Summary
Preserve and invoke original wire names
extensions/syntropy-mcp/src/catalog.ts, extensions/syntropy-mcp/src/index.ts, extensions/syntropy-mcp/src/catalog.test.ts
Catalog entries retain each tool’s original MCP name, and buildAgentTool uses that name directly instead of stripping prefixes.
Fail-closed read-only classification
extensions/syntropy-mcp/src/catalog.ts, extensions/syntropy-mcp/src/catalog.test.ts
Mutating or contradictory annotations now prevent a descriptor from being classified as provably read-only, with regression coverage for the classification rules.
Validate refresh and stale windows
extensions/syntropy-mcp/src/index.ts, extensions/syntropy-mcp/src/index.test.ts
Configuration parsing rejects maxStaleSeconds values below refreshSeconds and accepts equal values.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Poem

A rabbit hopped through MCP’s bright hall,
Keeping each wire name safe from a fall.
Mutations now veto, stale windows align,
And tests guard every tool in the line.
“Binky!” said Bun, “the catalog’s fine!”

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mangyinm/pr56-coderabbit-followup

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@supmo668
supmo668 merged commit 71f40ab into main Jul 14, 2026
18 of 23 checks passed
@supmo668
supmo668 deleted the mangyinm/pr56-coderabbit-followup branch July 14, 2026 07:39
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