feat: adding allowed_communication_protocols field - #26
Merged
Conversation
There was a problem hiding this comment.
5 issues found across 43 files
Prompt for AI agents (all 5 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="benches/protocol_comparison.rs">
<violation number="1" location="benches/protocol_comparison.rs:57">
P2: Discarding the Result from call_tool hides errors; handle or assert success so benchmark failures are visible.</violation>
</file>
<file name="src/lib.rs">
<violation number="1" location="src/lib.rs:418">
P3: Duplicate validation logic across call_tool and call_tool_stream; consider extracting into a small helper (e.g., validate_allowed_protocol(&ResolvedTool, &str) -> Result<()>).</violation>
</file>
<file name="src/loader.rs">
<violation number="1" location="src/loader.rs:216">
P2: This overwrites any provider-defined allowed_communication_protocols list, removing provider-specific protocol restrictions when a manual-level list is present.</violation>
</file>
<file name="src/providers/base/mod.rs">
<violation number="1" location="src/providers/base/mod.rs:80">
P2: Normalize and validate allowed protocol entries; filter to known keys, lowercase/trim, dedup, and fallback if none valid.</violation>
</file>
<file name="CHANGELOG.md">
<violation number="1" location="CHANGELOG.md:26">
P3: Use updated terminology: replace deprecated 'provider_type' with 'call_template_type' for consistency.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
…ction - Added validate_allowed_protocol helper to eliminate duplication between call_tool and call_tool_stream - Reduces code duplication by ~24 lines - Improves maintainability by centralizing validation logic - All tests pass (129/129)
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 by cubic
Adds protocol allowlists via allowed_communication_protocols to manuals, call templates, and providers, and enforces them at registration and runtime. Defaults to secure behavior: tools can only use their provider’s own protocol unless explicitly allowed.
New Features
Migration
Written for commit 8428ffa. Summary will update automatically on new commits.